Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
swdev:dotnet:arrays [2011/04/08 11:31] smayr |
swdev:dotnet:arrays [2011/05/24 15:48] (current) smayr [Resources] |
||
---|---|---|---|
Line 17: | Line 17: | ||
<code csharp> | <code csharp> | ||
// allocate memory | // allocate memory | ||
- | int array[][] = new int[2][10]; | + | int array[,] = new int[2][10]; |
// use array | // use array | ||
Line 43: | Line 43: | ||
DoubleDimArr[i, | DoubleDimArr[i, | ||
} | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Alternatively, | ||
+ | <code csharp> | ||
+ | int[,] arr = new int[,] {{1,2,3}, {4,5,6}, {7,8,9}, {10, | ||
+ | foreach(int a[] in arr) | ||
+ | { | ||
+ | foreach(int i in a) | ||
+ | { | ||
+ | Console.WriteLine(i); | ||
+ | } | ||
} | } | ||
</ | </ | ||
Line 48: | Line 60: | ||
== Resources == | == Resources == | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// |