DisplayNameResourceAttribute 类

表示与某一属性相关联的名称。

继承层次结构

System.Object
  System.Attribute
    System.ComponentModel.DisplayNameAttribute
      Microsoft.VisualStudio.Modeling.Design.DisplayNameResourceAttribute

命名空间:  Microsoft.VisualStudio.Modeling.Design
程序集:  Microsoft.VisualStudio.Modeling.Sdk.12.0(在 Microsoft.VisualStudio.Modeling.Sdk.12.0.dll 中)

语法

声明
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Property, AllowMultiple := False)> _
Public NotInheritable Class DisplayNameResourceAttribute _
    Inherits DisplayNameAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Property, AllowMultiple = false)]
public sealed class DisplayNameResourceAttribute : DisplayNameAttribute

DisplayNameResourceAttribute 类型公开以下成员。

构造函数

  名称 说明
公共方法 DisplayNameResourceAttribute(String, Type) 使用指定的显示名称键和类型初始化 DisplayNameResourceAttribute 类的新实例。
公共方法 DisplayNameResourceAttribute(String, Type, String) 使用指定的显示名称键,类型和资源名初始化 DisplayNameResourceAttribute 类的新实例。

页首

属性

  名称 说明
公共属性 DisplayName 获取本地化到当前区域性的显示名称。 (重写 DisplayNameAttribute.DisplayName。)
公共属性 DisplayNameKey 从指定的资源中获取显示名称资源入口的键。
公共属性 ResourceName 获取资源的根名称。
公共属性 Type 获取一个类型,它标识类型和包含资源的程序集。
公共属性 TypeId 当在派生类中实现时,获取该 Attribute 的唯一标识符。 (继承自 Attribute。)

页首

方法

  名称 说明
公共方法 Equals 确定两个 DisplayNameAttribute 实例是否相等。 (继承自 DisplayNameAttribute。)
公共方法 GetHashCode 返回此实例的哈希代码。 (继承自 DisplayNameAttribute。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
公共方法 IsDefaultAttribute 确定此特性是否为默认特性。 (继承自 DisplayNameAttribute。)
公共方法 Match 当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。 (继承自 Attribute。)
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)

页首

显式接口实现  

  名称 说明
显式接口实现私有方法 _Attribute.GetIDsOfNames 将一组名称映射为对应的一组调度标识符。 (继承自 Attribute。)
显式接口实现私有方法 _Attribute.GetTypeInfo 检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 (继承自 Attribute。)
显式接口实现私有方法 _Attribute.GetTypeInfoCount 检索对象提供的类型信息接口的数量(0 或 1)。 (继承自 Attribute。)
显式接口实现私有方法 _Attribute.Invoke 提供对某一对象公开的属性和方法的访问。 (继承自 Attribute。)

页首

备注

属性时,将在 PropertyGrid 控件中显示,名称的各个用户界面 (UI) 上下文用于标识目标属性,如。

此类的 DisplayName 属性获取对当前区域性的本地化描述字符串资源。 如果已本地化的字符串不可用,则 DisplayName 属性返回 DisplayNameKey 属性的值。

当您设计域特定语言 (DSL) 时,生成代码应用此特性设置为相应于 DSL 定义的域属性的每个属性。

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参阅

参考

Microsoft.VisualStudio.Modeling.Design 命名空间

CategoryResourceAttribute

DescriptionResourceAttribute

DisplayNameAttribute

ResourceManager