AttributeTableContainer.GetAttributes 方法 (MemberInfo, Type)

[本文档仅供预览,在以后的发行版中可能会发生更改。包含的空白主题用作占位符。]

枚举指定成员的自定义特性,包括基成员的继承特性。

命名空间:  Microsoft.Windows.Design.Metadata
程序集:  Microsoft.Windows.Design.Extensibility(在 Microsoft.Windows.Design.Extensibility.dll 中)

语法

声明
Public Function GetAttributes ( _
    member As MemberInfo, _
    attributeType As Type _
) As IEnumerable(Of Object)
public IEnumerable<Object> GetAttributes(
    MemberInfo member,
    Type attributeType
)
public:
IEnumerable<Object^>^ GetAttributes(
    MemberInfo^ member, 
    Type^ attributeType
)
member GetAttributes : 
        member:MemberInfo * 
        attributeType:Type -> IEnumerable<Object> 
public function GetAttributes(
    member : MemberInfo, 
    attributeType : Type
) : IEnumerable<Object>

参数

  • attributeType
    类型:System.Type
    要检索的特性类型,或为 nulla null reference (Nothing in Visual Basic) 以检索所有特性。

返回值

类型:System.Collections.Generic.IEnumerable<Object>
特性的枚举。

异常

异常 条件
ArgumentNullException

member 为 nulla null reference (Nothing in Visual Basic)。

备注

返回的特性与其他成员的特性合并,因成员类型而异。

  • 对于属性,返回的特性也将与属性类型的特性合并。

  • 对于事件,返回的特性将与事件处理程序类型的特性合并。

  • 对于类型,返回的特性也将与类型上实现的接口特性合并。

如果不希望执行该自动合并行为,则使用 GetLocalAttributes 方法作为替代。

.NET Framework 安全性

请参见

参考

AttributeTableContainer 类

GetAttributes 重载

Microsoft.Windows.Design.Metadata 命名空间