语言

AttributeTable.GetCustomAttributes 方法

定义

返回为给定参数提供的所有属性的枚举。

重载

名称 说明
GetCustomAttributes(Type)

返回为指定类型提供的所有类级属性的枚举。

GetCustomAttributes(Type, MemberDescriptor)

返回为指定类型的指定成员提供的所有属性的枚举。

GetCustomAttributes(Type, MemberInfo)

返回为指定类型的指定成员提供的所有属性的枚举。

GetCustomAttributes(Type, String)

返回为指定类型的指定成员提供的所有属性的枚举。

GetCustomAttributes(Type, DependencyProperty)

返回为指定类型的指定依赖项提供的所有属性的枚举。

注解

此方法永远不会返回 null 枚举。

GetCustomAttributes(Type)

返回为指定类型提供的所有类级属性的枚举。

public:
 System::Collections::IEnumerable ^ GetCustomAttributes(Type ^ type);
public System.Collections.IEnumerable GetCustomAttributes(Type type);
member this.GetCustomAttributes : Type -> System.Collections.IEnumerable
Public Function GetCustomAttributes (type As Type) As IEnumerable

参数

type
Type

要为其获取类级属性的类型。

返回

与条件匹配的属性的枚举。 这永远不会返回 null 枚举。

例外

type 是 null。

适用于

GetCustomAttributes(Type, MemberDescriptor)

返回为指定类型的指定成员提供的所有属性的枚举。

public:
 System::Collections::IEnumerable ^ GetCustomAttributes(Type ^ ownerType, System::ComponentModel::MemberDescriptor ^ descriptor);
public System.Collections.IEnumerable GetCustomAttributes(Type ownerType, System.ComponentModel.MemberDescriptor descriptor);
member this.GetCustomAttributes : Type * System.ComponentModel.MemberDescriptor -> System.Collections.IEnumerable
Public Function GetCustomAttributes (ownerType As Type, descriptor As MemberDescriptor) As IEnumerable

参数

ownerType
Type

包含成员的类型。

descriptor
MemberDescriptor

要为其获取自定义属性的成员描述符。

返回

与条件匹配的属性的枚举。 这永远不会返回 null 枚举。

例外

ownerType 或 descriptor 为 null.

适用于

GetCustomAttributes(Type, MemberInfo)

返回为指定类型的指定成员提供的所有属性的枚举。

public:
 System::Collections::IEnumerable ^ GetCustomAttributes(Type ^ ownerType, System::Reflection::MemberInfo ^ member);
public System.Collections.IEnumerable GetCustomAttributes(Type ownerType, System.Reflection.MemberInfo member);
member this.GetCustomAttributes : Type * System.Reflection.MemberInfo -> System.Collections.IEnumerable
Public Function GetCustomAttributes (ownerType As Type, member As MemberInfo) As IEnumerable

参数

ownerType
Type

包含成员的类型。

member
MemberInfo

要为其提供属性的成员。

返回

与条件匹配的属性的枚举。 这永远不会返回 null 枚举。

例外

ownerType 或 member 为 null.

适用于

GetCustomAttributes(Type, String)

返回为指定类型的指定成员提供的所有属性的枚举。

public:
 System::Collections::IEnumerable ^ GetCustomAttributes(Type ^ ownerType, System::String ^ memberName);
public System.Collections.IEnumerable GetCustomAttributes(Type ownerType, string memberName);
member this.GetCustomAttributes : Type * string -> System.Collections.IEnumerable
Public Function GetCustomAttributes (ownerType As Type, memberName As String) As IEnumerable

参数

ownerType
Type

依赖属性的所有者类型。

memberName
String

要为其提供属性的成员的名称。

返回

与条件匹配的属性的枚举。 这永远不会返回 null 枚举。

例外

ownerType 或 memberName 为 null.

适用于

GetCustomAttributes(Type, DependencyProperty)

返回为指定类型的指定依赖项提供的所有属性的枚举。

public:
 System::Collections::IEnumerable ^ GetCustomAttributes(Type ^ ownerType, System::Windows::DependencyProperty ^ dp);
public System.Collections.IEnumerable GetCustomAttributes(Type ownerType, System.Windows.DependencyProperty dp);
member this.GetCustomAttributes : Type * System.Windows.DependencyProperty -> System.Collections.IEnumerable
Public Function GetCustomAttributes (ownerType As Type, dp As DependencyProperty) As IEnumerable

参数

ownerType
Type

依赖属性的所有者类型。

dp
DependencyProperty

要为其获取自定义属性的依赖属性。

返回

与条件匹配的属性的枚举。 这永远不会返回 null 枚举。

例外

ownerType 或 dp 为 null.

适用于