Tag: 隐式类型

为什么我不能将数组初始值设定项与隐式类型变量一起使用?

为什么我不能将数组初始值设定项与隐式类型变量一起使用? string[] words = { “apple”, “strawberry”, “grape” }; // legal string[] words = new string[]{ “apple”, “strawberry”, “grape” }; // legal var words = new []{ “apple”, “strawberry”, “grape” }; // legal var words = new string[]{ “apple”, “strawberry”, “grape” }; // legal var words = { “apple”, “strawberry”, “grape”, “peach” }; // ILLEGAL […]