Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

This is my first post in this forum... and I hope that I find the proper answer my question :)

I think that I have to talk about my problem right in this forum... anyway my problem is with the following code:

 

I'm a C/C++ programmer and I loop at C# as a C programmer point of you, thus I tried to initialize a 2D array as follows:

 

using System;

namespace CSharp_Scanner
{
class scanner
{
	static int [][] array = { {1,2}, {3,4} };

	static void Main(string[] args)
	{
	}
}
}

 

but it tells that: Array initializer can only be used in a variable or a field initializer.

 

So please can anyone help me with initializing my array inside a class...? ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...