Your "test" variable expects a multi-dimensional array of integers.
However in the line "test = {foo, bar}", you are providing it with 2
objects that are integer arrays.

int is not the same as int[]. Therefore, it does not compile.

On Feb 13, 11:01 pm, cityuk <[email protected]> wrote:
> Dear All,
>
> I want to do something like the following and C# refuses to compile it
> - searched the web, but did not find any clue. If someone could shed
> some light, I would be grateful.
>
> int[,] test=new int[2,5];
> int[] foo = new int[5]{12,24,36,48,60};
> int[] bar = new int[5]{12,24,36,48,60};
> test ={foo, bar}; // this does not compile
> test = {{12,24,36,48,60}, {12,24,36,48,60}}; // this compiles fine and
> in my knowledge it is the same as the one on the previous line
> test = { new int[5] {12,24,36,48,60}, new int[5] {12,24,36,48,60}}; //
> does not compile again.
>
> Regards,
> George

Reply via email to