AttributeTableContainer.GetAttributes 方法 (MemberInfo, Type, Func<Object, Object>)

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

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

语法

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

参数

  • attributeType
    类型:System.Type
    要检索的特性类型,或为 nullnull 引用(在 Visual Basic 中为 Nothing) 以检索所有特性。
  • reflectionMapper
    类型:System.Func<Object, Object>
    可选的映射函数,用于将传入的反射元数据映射到运行时元数据。

返回值

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

异常

异常 条件
ArgumentNullException

member 为 nullnull 引用(在 Visual Basic 中为 Nothing)。

备注

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

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

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

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

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

.NET Framework 安全性

请参见

参考

AttributeTableContainer 类

GetAttributes 重载

Microsoft.Windows.Design.Metadata 命名空间