Error thrown on List initialization
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]();
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);
精彩评论