Reputation:
Both of these are declaring Jagged Lists correct?
//Declare 'Jagged' List
//Version 1
private List<string>[] fieldInfoArray = new List<string>[7];
//Version 2
private List<string>[][] fieldInfoArray = new List<string>[7][];
There is no difference between these two declarations right? They are both essentially doing the same thing correct? Declaring a Jagged List?
Upvotes: 3
Views: 81
Reputation: 14389
List<string>
.List<string>
s.List<string>
" (and not just "List<string>
").Upvotes: 2
Reputation: 801
private List<string>[] fieldInfoArray = new List<string>[7];
This is declaring an array, of size 7, of List<string>
.
private List<string>[][] fieldInfoArray = new List<string>[7][];
This is declaring a two dimensional array of List<string>
, containing 7 rows of List<string>
arrays who are yet to be initialized/allocated.
Upvotes: 0