Hi Martin,
A multidimensional array is in C# defined with a , per dimension, so your
second definition is correct.
int[,] test = new int[list1.Count, list2.Count]
On Tue, 05 Sep 2006 11:16:23 +0200, Martin Pöpping
<(E-Mail Removed)> wrote:
> Hello,
>
>
> I´m new in programming with C# and having some troubles with
> understanding the definitions of multi-dimensional arrays.
>
> Is there any difference between defining an Array with [][] or [,]?
>
>
> I tried to define it like this:
>
> int[][] test = new int[list1.Count][list2.Count]
>
> but this doesn´t work.
>
>
> A definition like:
>
> int[,] test = new int[list1.Count, list2.Count]
>
>
> seems to work.
>
>
> So I am asking myself now what is right and if there are any differences.
>
> Or do I have a mistake in my first try to define an 2-dimensional array?
>
>
>
> Regards,
>
> Martin
--
Happy Coding!
Morten Wennevik [C# MVP]
|