关于gmcs对C# 3.0支持的问题

软件和网站开发以及相关技术探讨
回复
头像
jiangpeng
帖子: 223
注册时间: 2006-07-25 9:33
联系:

关于gmcs对C# 3.0支持的问题

#1

帖子 jiangpeng » 2008-11-24 21:20

$ dpkg -s mono-gmcs
...
With C# 3.0 it supports:
- Language Integrated Query (LINQ)
- object initializers
- collection initializers
- anonymous types
- local variable type inference
...
不是应该支持“collection initializers“吗?
为啥

代码: 全选

IList<int> a = new List<int> { 1, 2, 3 };
还报这个错呢?
error CS1644: Feature `collection initializers' cannot be used because it is not part of the C# 2.0 language specification
Take what man makes and use it, But do not worship it, For it shall pass. -- Anonymous

Twitter @jiangpeng
caca0513
帖子: 33
注册时间: 2008-11-02 11:55

Re: 关于gmcs对C# 3.0支持的问题

#2

帖子 caca0513 » 2008-11-26 13:53

还没真正用过mono, 不过看提示意思, 编译器说collection initializers不是 C# 2.0 规范的一部分, 而楼主看到支持collection initializers的是C# 3.0 ....
回复