Export (0) Print
Expand All

MemberInfo Class

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

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

[ClassInterfaceAttribute(ClassInterfaceType.None)]
[ComVisibleAttribute(true)]
public abstract class MemberInfo : ICustomAttributeProvider

The MemberInfo type exposes the following members.

  NameDescription
Protected methodMemberInfoInitializes a new instance of the MemberInfo class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360DeclaringTypeGets the class that declares this member.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360MemberTypeWhen overridden in a derived class, gets a MemberTypes value indicating the type of the member — method, constructor, event, and so on.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360MetadataTokenGets a value that identifies a metadata element.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360ModuleGets the module in which the type that declares the member represented by the current MemberInfo is defined.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360NameGets the name of the current member.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360ReflectedTypeGets the class object that was used to obtain this instance of MemberInfo.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360Equals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360FinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360GetCustomAttributes(Boolean)When overridden in a derived class, returns an array of all custom attributes applied to this member.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360GetCustomAttributes(Type, Boolean)When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360GetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360GetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360IsDefinedWhen 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 methodSupported by Silverlight for Windows PhoneSupported by Xbox 360MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360ToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The MemberInfo class is the abstract base class for classes used to obtain information about all members of a class (constructors, events, fields, methods, and properties).

This class introduces the basic functionality that all members provide.

In Silverlight-based applications, you cannot derive new types from MemberInfo.

The following example displays the member name and type of a specified class.


using System;
using System.Reflection;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Get the Type and MemberInfo.
      Type MyType = typeof(System.Threading.Thread);

      // Display the MemberType and the member.
      outputBlock.Text += String.Format("There are {0} members in {1}:\n", 
         MyType.GetMembers().Length, MyType.FullName);

      foreach (MemberInfo mi in MyType.GetMembers())
      {
         outputBlock.Text += String.Format("  {0} - {1}\n",
            mi.MemberType, mi);
      }
   }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

This type is thread safe.

Community Additions

Show:
© 2014 Microsoft