Skip to Main Content
C# in a Nutshell
book

C# in a Nutshell

by Ben Albahari, Ted Neward, Peter Drayton
March 2002
Intermediate to advanced content levelIntermediate to advanced
864 pages
31h 8m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell

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, // 
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 8.0 in a Nutshell

C# 8.0 in a Nutshell

Joseph Albahari, Eric Johannsen
C# 10 in a Nutshell

C# 10 in a Nutshell

Joseph Albahari
C# in a Nutshell, Second Edition

C# in a Nutshell, Second Edition

Peter Drayton, Ben Albahari, Ted Neward
Code like a Pro in C#

Code like a Pro in C#

Jort Rodenburg

Publisher Resources

ISBN: 0596001819Catalog PageErrata