【发布时间】:2013-03-17 13:03:50
【问题描述】:
你能解释一下“property:”这个词是什么意思吗?
[property: NotifyParentProperty( true )]
public string Filename
{
get;
set;
}
【问题讨论】:
标签: c# properties attributes
你能解释一下“property:”这个词是什么意思吗?
[property: NotifyParentProperty( true )]
public string Filename
{
get;
set;
}
【问题讨论】:
标签: c# properties attributes
表示将Attribute应用于属性。
在这种特定情况下,它是多余的,可以省略。
这种元素定义了Attribute Target,并且在目标可能不明确时最有用,例如目标method和return。 Visual Studio 还使用AssemblyInfo.cs 中的目标assembly 生成属性,这是许多项目模板的一部分。
更多信息和可能的属性目标列表:
Disambiguating Attribute Targets (MSDN)
【讨论】: