AttributeTable.GetCustomAttributes 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回提供給給定引數之所有屬性的列舉。
多載
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
相依性屬性的擁有者型別。
要取得其自訂屬性 (Attribute) 的相依性屬性 (Property)。
傳回
符合準則之屬性的列舉。 這絕不會傳回 null 列舉。
例外狀況
ownerType
或 dp
為 null
。