C#中 "[]"的作用
C#2.0中方括号 "[]"都有几种用处?哪位给解答下?
我已经知道的:
1) int i[10]; 代表数组
2) [Attribute]属性
3) [Web Method] 我感觉也算是属性吧,表示web方法。
还有那种用途?
大家看一下的代码,是一个类下的变量声明
//变量
[XmlArray(IsNullable = true)]
[XmlArrayItem(typeof(bool)),
XmlArrayItem(typeof(char)),
XmlArrayItem(typeof(string)),
XmlArrayItem(typeof(byte)),
XmlArrayItem(typeof(byte[])),
.....
XmlArrayItem(typeof(XmlDocument))]
这种声明变量的方式头一次见,谁能给个详细的解释?这种声明方式有什么好处?