请问:C#中的“[]”表示什么?例如下面的代码:
[Category("Behaviour")]
[Description("Get or sets the control to validate.")]
[DefaultValue(null)]
[TypeConverter(typeof(ValidatableControlConverter))]
[Category("Behaviour")]
[Description("Get or sets the control to validate.")]
[DefaultValue(null)]
[TypeConverter(typeof(ValidatableControlConverter))]
Description 用于描述属性。
方括号 ([]) 用于数组、索引器和属性,也可用于指针。
详见msdn
英文介绍
http://msdn.microsoft.com/en-us/library/system.attribute.aspx
中文介绍
http://msdn.microsoft.com/zh-cn/library/system.attribute.aspx
Description 用于描述属性。
方括号 ([]) 用于数组、索引器和属性,也可用于指针。
可以是程序集、类、构造函数、委托、枚举、事件、字段、接口、方法、可移植可执行文件模块、参数、属性 (Property)、返回值、结构或其他属性 (Attribute)
Attribute 类,请问它在程序段中一般起什么作用呢?
用于属性时,下面的代码:
[Category("Behaviour")]
[Description("Get or sets the control to validate.")]
[DefaultValue(null)]
[TypeConverter(typeof(ValidatableControlConverter))]表示属性,有什么作用。