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, //
Get C# in a Nutshell 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.