Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Reflection.​MemberInfo

Assembly: System.Runtime

Inheritance: object → MemberInfo

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

Properties

CustomAttributes
Gets a collection that contains this member's custom attributes.
public Type
DeclaringType
Gets the class that declares this member.
public bool
IsCollectible
Gets a value that indicates whether this <see cref="T:System.Reflection.MemberInfo" /> object references one or more assemblies held in a collectible <see cref="T:System.Runtime.Loader.AssemblyLoadContext" /> .
public MemberTypes
MemberType
When overridden in a derived class, gets a <see cref="T:System.Reflection.MemberTypes" /> value indicating the type of the member - method, constructor, event, and so on.
public int
MetadataToken
Gets a value that identifies a metadata element.
public Module
Module
Gets the module in which the type that declares the member represented by the current <see cref="T:System.Reflection.MemberInfo" /> is defined.
public string
Name
Gets the name of the current member.
public Type
ReflectedType
Gets the class object that was used to obtain this instance of <see langword="MemberInfo" /> .

Methods

public bool
Equals​(object obj)
obj An object to compare with this instance, or <see langword="null" /> .
Returns <see langword="true" /> if <paramref name="obj" /> equals the type and value of this instance; otherwise, <see langword="false" /> .
Returns a value that indicates whether this instance is equal to a specified object.
public object[]
GetCustomAttributes​(bool inherit)
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
Returns An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
When overridden in a derived class, returns an array of all custom attributes applied to this member.
public object[]
GetCustomAttributes​(Type attributeType, bool inherit)
attributeType The type of attribute to search for. Only attributes that are assignable to this type are returned.
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
Returns An array of custom attributes applied to this member, or an array with zero elements if no attributes assignable to <paramref name="attributeType" /> have been applied.
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by <see cref="T:System.Type" /> .
GetCustomAttributesData​()
Returns A generic list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.
Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.
public int
GetHashCode​()
Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public bool
HasSameMetadataDefinitionAs​(MemberInfo other)
public bool
IsDefined​(Type attributeType, bool inherit)
attributeType The type of custom attribute to search for. The search includes derived types.
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
Returns <see langword="true" /> if one or more instances of <paramref name="attributeType" /> or any of its derived types is applied to this member; otherwise, <see langword="false" /> .
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.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.