O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 method MemberInfo();  
// Public Instance Properties
   public abstract field Type DeclaringType{get; } 
   public abstract field MemberTypes MemberType{get; } 
   public abstract field string Name{get; } 
   public abstract field Type ReflectedType{get; } 
// Public Instance Methods
   public abstract method object[] GetCustomAttributes( // implements ICustomAttributeProvider
        bool inherit);  
   public abstract method object[] GetCustomAttributes( // implements ICustomAttributeProvider
        Type attributeType, bool inherit);  
   public abstract method bool IsDefined(Type attributeType, // 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required