Reputation: 1099
Why would this yield a 'Method name expected' error? (The part under new List[10] is squiggly underlined.)
List<int>[] whatever = new List<int>[10]();
Upvotes: 1
Views: 99
Reputation: 68737
List<int>[] whatever = new List<int>[10];
The syntax for initializing an array doesn't need parentheses. If you're trying to initialize a List with a starting capacity of 10, use:
List<int> whatever = new List<int>(10);
Upvotes: 7