MemberInfo Class
Obtains information about the attributes of a member and provides access to member metadata.
System.Reflection.MemberInfo
System.Reflection.EventInfo
System.Reflection.FieldInfo
System.Reflection.MethodBase
System.Reflection.PropertyInfo
System.Type
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
The MemberInfo type exposes the following members.
| Name | Description | |
|---|---|---|
|
DeclaringType | Gets the class that declares this member. |
|
MemberType | When overridden in a derived class, gets a MemberTypes value indicating the type of the member — method, constructor, event, and so on. |
|
MetadataToken | Gets a value that identifies a metadata element. |
|
Module | Gets the module in which the type that declares the member represented by the current MemberInfo is defined. |
|
Name | Gets the name of the current member. |
|
ReflectedType | Gets the class object that was used to obtain this instance of MemberInfo. |
| Name | Description | |
|---|---|---|
|
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
|
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
|
GetCustomAttributes(Boolean) | When overridden in a derived class, returns an array of all custom attributes applied to this member. |
|
GetCustomAttributes(Type, Boolean) | When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type. |
|
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
IsDefined | When 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. |
|
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.
Note:
|
|---|
|
To run this example, see Building Examples That Use a Demo Method and a TextBlock Control. |
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); } } }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Note: