Name

MemberInfo

Synopsis

This class is the base type for all reflective types defined in the .NET environment; it defines the basic data associated with any member (field, method, property, event, nested type) of a given type. Note that even System.Type itself inherits from this class.

By itself, MemberInfo is a fairly simple type. It consists of four properties: DeclaringType (a reference to the System.Type in which this member was declared, which might be a base type to the class being reflected over), MemberType (an enumeration describing the type of the member), Name, and ReflectedType (the System.Type instance from which this MemberInfo object was received in the first place). MemberInfo also consists of two methods, GetCustomAttributes( ) and IsDefined( ), both of which deal with any custom attributes defined on this member.

public abstract class MemberInfo : ICustomAttributeProvider {
// Protected Constructors
   protected MemberInfo( );
// Public Instance Properties
   public abstract Type DeclaringType{get; }
   public abstract MemberTypes MemberType{get; }
   public abstract string Name{get; }
   public abstract Type ReflectedType{get; }
// Public Instance Methods
   public abstract object[ ] GetCustomAttributes( bool inherit);  
// implements ICustomAttributeProvider
   public abstract object[ ] GetCustomAttributes(Type attributeType, bool inherit)
// implements ICustomAttributeProvider
   public abstract bool IsDefined(Type attributeType, bool inherit)
// implements ICustomAttributeProvider
}

Get C# in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.