共用方式為


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 列舉。

例外狀況

ownerTypedescriptornull

適用於

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 列舉。

例外狀況

ownerTypemembernull

適用於

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 列舉。

例外狀況

ownerTypememberNamenull

適用於

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 列舉。

例外狀況

ownerTypedpnull

適用於