开发者

Error thrown on List initialization

开发者 https://www.devze.com 2023-02-04 02:53 出处:网络
Why would this yield a \'Method name expected\' error?(The part under new List[10] is squiggly 开发者_运维知识库underlined.)

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消