【问题标题】:What is word "property:" in Attribute属性中的“属性:”一词是什么
【发布时间】:2013-03-17 13:03:50
【问题描述】:

你能解释一下“property:”这个词是什么意思吗?

[property: NotifyParentProperty( true )]
public string Filename
{
  get;
  set;
}

【问题讨论】:

    标签: c# properties attributes


    【解决方案1】:

    表示将Attribute应用于属性。
    在这种特定情况下,它是多余的,可以省略。

    这种元素定义了Attribute Target,并且在目标可能不明确时最有用,例如目标methodreturn。 Visual Studio 还使用AssemblyInfo.cs 中的目标assembly 生成属性,这是许多项目模板的一部分。

    更多信息和可能的属性目标列表:
    Disambiguating Attribute Targets (MSDN)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-13
      • 2014-09-02
      • 2019-06-12
      • 2011-12-11
      • 2021-08-12
      • 2013-02-15
      • 2010-09-06
      相关资源
      最近更新 更多