AttributeTable.GetCustomAttributes Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an enumeration of all attributes provided for the given arguments.
Overloads
GetCustomAttributes(Type) |
Returns an enumeration of all class-level attributes provided for the specified type. |
GetCustomAttributes(Type, MemberDescriptor) |
Returns an enumeration of all attributes provided for the specified member of the specified type. |
GetCustomAttributes(Type, MemberInfo) |
Returns an enumeration of all attributes provided for the specified member of the specified type. |
GetCustomAttributes(Type, String) |
Returns an enumeration of all attributes provided for the specified member of the specified type. |
GetCustomAttributes(Type, DependencyProperty) |
Returns an enumeration of all attributes provided for the specified dependency of the specified type. |
Remarks
This method never returns a null enumeration.
GetCustomAttributes(Type)
Returns an enumeration of all class-level attributes provided for the specified 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
Parameters
- type
- Type
The type to get class-level attributes for.
Returns
An enumeration of attributes that match the criteria. This will never return a null enumeration.
Exceptions
type
is null
.
Applies to
GetCustomAttributes(Type, MemberDescriptor)
Returns an enumeration of all attributes provided for the specified member of the specified type.
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
Parameters
- ownerType
- Type
The type that contains the member.
- descriptor
- MemberDescriptor
A member descriptor to get custom attributes for.
Returns
An enumeration of attributes that match the criteria. This will never return a null enumeration.
Exceptions
ownerType
or descriptor
is null
.
Applies to
GetCustomAttributes(Type, MemberInfo)
Returns an enumeration of all attributes provided for the specified member of the specified type.
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
Parameters
- ownerType
- Type
The type that contains the member.
- member
- MemberInfo
The member to provide attributes for.
Returns
An enumeration of attributes that match the criteria. This will never return a null enumeration.
Exceptions
ownerType
or member
is null
.
Applies to
GetCustomAttributes(Type, String)
Returns an enumeration of all attributes provided for the specified member of the specified type.
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
Parameters
- ownerType
- Type
The owner type of the dependency property.
- memberName
- String
The name of the member to provide attributes for.
Returns
An enumeration of attributes that match the criteria. This will never return a null enumeration.
Exceptions
ownerType
or memberName
is null
.
Applies to
GetCustomAttributes(Type, DependencyProperty)
Returns an enumeration of all attributes provided for the specified dependency of the specified type.
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
Parameters
- ownerType
- Type
The owner type of the dependency property.
A dependency property to get custom attributes for.
Returns
An enumeration of attributes that match the criteria. This will never return a null enumeration.
Exceptions
ownerType
or dp
is null
.