开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜