mscorlib(4.0.0.0) API with additions
System.Reflection.MemberInfo Class Referenceabstract

Obtains information about the attributes of a member and provides access to member metadata. More...

Inheritance diagram for System.Reflection.MemberInfo:
[legend]
Collaboration diagram for System.Reflection.MemberInfo:
[legend]

Public Member Functions

abstract object [] GetCustomAttributes (bool inherit)
 When overridden in a derived class, returns an array of all custom attributes applied to this member. More...
 
abstract object [] GetCustomAttributes (Type attributeType, bool inherit)
 When overridden in a derived class, returns an array of custom attributes applied to this member and identified by T:System.Type. More...
 
abstract bool IsDefined (Type attributeType, bool inherit)
 When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member. More...
 
virtual IList< CustomAttributeDataGetCustomAttributesData ()
 Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attributes that have been applied to the target member. More...
 
override bool Equals (object obj)
 Returns a value that indicates whether this instance is equal to a specified object. More...
 
override int GetHashCode ()
 Returns the hash code for this instance. More...
 
- Public Member Functions inherited from System.Runtime.InteropServices._MemberInfo
new string ToString ()
 Provides COM objects with version-independent access to the M:System.Object.ToString method. More...
 

Static Public Member Functions

static bool operator== (MemberInfo left, MemberInfo right)
 Indicates whether two T:System.Reflection.MemberInfo objects are equal. More...
 
static bool operator != (MemberInfo left, MemberInfo right)
 Indicates whether two T:System.Reflection.MemberInfo objects are not equal. More...
 

Properties

abstract MemberTypes MemberType [get]
 When overridden in a derived class, gets a T:System.Reflection.MemberTypes value indicating the type of the member — method, constructor, event, and so on. More...
 
abstract string Name [get]
 Gets the name of the current member. More...
 
abstract Type DeclaringType [get]
 Gets the class that declares this member. More...
 
abstract Type ReflectedType [get]
 Gets the class object that was used to obtain this instance of MemberInfo. More...
 
virtual IEnumerable< CustomAttributeDataCustomAttributes [get]
 Gets a collection that contains this member's custom attributes. More...
 
virtual int MetadataToken [get]
 Gets a value that identifies a metadata element. More...
 
virtual Module Module [get]
 Gets the module in which the type that declares the member represented by the current T:System.Reflection.MemberInfo is defined. More...
 
- Properties inherited from System.Runtime.InteropServices._MemberInfo
MemberTypes MemberType [get]
 Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.MemberType property. More...
 
string Name [get]
 Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.Name property. More...
 
Type DeclaringType [get]
 Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.DeclaringType property. More...
 
Type ReflectedType [get]
 Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.ReflectedType property. More...
 

Detailed Description

Obtains information about the attributes of a member and provides access to member metadata.

Definition at line 14 of file MemberInfo.cs.

Member Function Documentation

◆ Equals()

override bool System.Reflection.MemberInfo.Equals ( object  obj)

Returns a value that indicates whether this instance is equal to a specified object.

Parameters
objAn object to compare with this instance, or null.
Returns
true if obj equals the type and value of this instance; otherwise, false.

Implements System.Runtime.InteropServices._MemberInfo.

Definition at line 196 of file MemberInfo.cs.

◆ GetCustomAttributes() [1/2]

abstract object [] System.Reflection.MemberInfo.GetCustomAttributes ( bool  inherit)
pure virtual

When overridden in a derived class, returns an array of all custom attributes applied to this member.

Parameters
inherittrue to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks.
Returns
An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
Exceptions
T:System.InvalidOperationExceptionThis member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context.
T:System.TypeLoadExceptionA custom attribute type could not be loaded.

Implements System.Reflection.ICustomAttributeProvider.

Implemented in System.Reflection.Emit.TypeBuilder, System.Reflection.Emit.DynamicMethod, System.Reflection.Emit.MethodBuilder, System.Reflection.Emit.GenericTypeParameterBuilder, System.Reflection.Emit.EnumBuilder, System.Reflection.TypeDelegator, System.Reflection.Emit.PropertyBuilder, System.Reflection.Emit.ConstructorBuilder, System.Runtime.InteropServices.ComAwareEventInfo, and System.Reflection.Emit.FieldBuilder.

◆ GetCustomAttributes() [2/2]

abstract object [] System.Reflection.MemberInfo.GetCustomAttributes ( Type  attributeType,
bool  inherit 
)
pure virtual

When overridden in a derived class, returns an array of custom attributes applied to this member and identified by T:System.Type.

Parameters
attributeTypeThe type of attribute to search for. Only attributes that are assignable to this type are returned.
inherittrue to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks.
Returns
An array of custom attributes applied to this member, or an array with zero elements if no attributes assignable to attributeType have been applied.
Exceptions
T:System.TypeLoadExceptionA custom attribute type cannot be loaded.
T:System.ArgumentNullExceptionIf attributeType is null.
T:System.InvalidOperationExceptionThis member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context.

Implements System.Reflection.ICustomAttributeProvider.

Implemented in System.Reflection.Emit.TypeBuilder, System.Reflection.Emit.DynamicMethod, System.Reflection.Emit.MethodBuilder, System.Reflection.Emit.GenericTypeParameterBuilder, System.Reflection.Emit.EnumBuilder, System.Reflection.TypeDelegator, System.Reflection.Emit.PropertyBuilder, System.Reflection.Emit.ConstructorBuilder, System.Reflection.Emit.FieldBuilder, and System.Runtime.InteropServices.ComAwareEventInfo.

◆ GetCustomAttributesData()

virtual IList<CustomAttributeData> System.Reflection.MemberInfo.GetCustomAttributesData ( )
virtual

Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attributes that have been applied to the target member.

Returns
A generic list of T:System.Reflection.CustomAttributeData objects representing data about the attributes that have been applied to the target member.

Definition at line 126 of file MemberInfo.cs.

◆ GetHashCode()

override int System.Reflection.MemberInfo.GetHashCode ( )

Returns the hash code for this instance.

Returns
A 32-bit signed integer hash code.

Implements System.Runtime.InteropServices._MemberInfo.

Definition at line 204 of file MemberInfo.cs.

◆ IsDefined()

abstract bool System.Reflection.MemberInfo.IsDefined ( Type  attributeType,
bool  inherit 
)
pure virtual

When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.

Parameters
attributeTypeThe type of custom attribute to search for. The search includes derived types.
inherittrue to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks.
Returns
true if one or more instances of attributeType or any of its derived types is applied to this member; otherwise, false.

Implements System.Reflection.ICustomAttributeProvider.

Implemented in System.Reflection.Emit.TypeBuilder, System.Reflection.Emit.DynamicMethod, System.Reflection.Emit.MethodBuilder, System.Reflection.Emit.GenericTypeParameterBuilder, System.Reflection.Emit.EnumBuilder, System.Reflection.TypeDelegator, System.Reflection.Emit.PropertyBuilder, System.Reflection.Emit.ConstructorBuilder, System.Runtime.InteropServices.ComAwareEventInfo, and System.Reflection.Emit.FieldBuilder.

◆ operator !=()

static bool System.Reflection.MemberInfo.operator != ( MemberInfo  left,
MemberInfo  right 
)
static

Indicates whether two T:System.Reflection.MemberInfo objects are not equal.

Parameters
leftThe T:System.Reflection.MemberInfo to compare to right .
rightThe T:System.Reflection.MemberInfo to compare to left .
Returns
true if left is not equal to right ; otherwise false.

Definition at line 186 of file MemberInfo.cs.

◆ operator==()

static bool System.Reflection.MemberInfo.operator== ( MemberInfo  left,
MemberInfo  right 
)
static

Indicates whether two T:System.Reflection.MemberInfo objects are equal.

Parameters
leftThe T:System.Reflection.MemberInfo to compare to right .
rightThe T:System.Reflection.MemberInfo to compare to left .
Returns
true if left is equal to right ; otherwise false.

Definition at line 137 of file MemberInfo.cs.

Property Documentation

◆ CustomAttributes

virtual IEnumerable<CustomAttributeData> System.Reflection.MemberInfo.CustomAttributes
get

Gets a collection that contains this member's custom attributes.

Returns
A collection that contains this member's custom attributes.

Definition at line 54 of file MemberInfo.cs.

◆ DeclaringType

abstract Type System.Reflection.MemberInfo.DeclaringType
get

Gets the class that declares this member.

Returns
The Type object for the class that declares this member.

Definition at line 36 of file MemberInfo.cs.

◆ MemberType

abstract MemberTypes System.Reflection.MemberInfo.MemberType
get

When overridden in a derived class, gets a T:System.Reflection.MemberTypes value indicating the type of the member — method, constructor, event, and so on.

Returns
A T:System.Reflection.MemberTypes value indicating the type of member.

Definition at line 19 of file MemberInfo.cs.

◆ MetadataToken

virtual int System.Reflection.MemberInfo.MetadataToken
get

Gets a value that identifies a metadata element.

Returns
A value which, in combination with P:System.Reflection.MemberInfo.Module, uniquely identifies a metadata element.
Exceptions
T:System.InvalidOperationExceptionThe current T:System.Reflection.MemberInfo represents an array method, such as Address, on an array type whose element type is a dynamic type that has not been completed. To get a metadata token in this case, pass the T:System.Reflection.MemberInfo object to the M:System.Reflection.Emit.ModuleBuilder.GetMethodToken(System.Reflection.MethodInfo) method; or use the M:System.Reflection.Emit.ModuleBuilder.GetArrayMethodToken(System.Type,System.String,System.Reflection.CallingConventions,System.Type,System.Type[]) method to get the token directly, instead of using the M:System.Reflection.Emit.ModuleBuilder.GetArrayMethod(System.Type,System.String,System.Reflection.CallingConventions,System.Type,System.Type[]) method to get a T:System.Reflection.MethodInfo first.

Definition at line 66 of file MemberInfo.cs.

◆ Module

virtual Module System.Reflection.MemberInfo.Module
get

Gets the module in which the type that declares the member represented by the current T:System.Reflection.MemberInfo is defined.

Returns
The T:System.Reflection.Module in which the type that declares the member represented by the current T:System.Reflection.MemberInfo is defined.
Exceptions
T:System.NotImplementedExceptionThis method is not implemented.

Definition at line 78 of file MemberInfo.cs.

◆ Name

abstract string System.Reflection.MemberInfo.Name
get

Gets the name of the current member.

Returns
A T:System.String containing the name of this member.

Definition at line 27 of file MemberInfo.cs.

◆ ReflectedType

abstract Type System.Reflection.MemberInfo.ReflectedType
get

Gets the class object that was used to obtain this instance of MemberInfo.

Returns
The Type object through which this MemberInfo object was obtained.

Definition at line 45 of file MemberInfo.cs.


The documentation for this class was generated from the following file: