Retrieves the name of this member.
[Visual Basic] MustOverride Public ReadOnly Property Name As String [C#] public string Name {abstract get;} [C++] public: __property virtual String* get_Name() = 0; [JScript] public abstract function get Name() : String;
Read-only.
A String containing the name of this member.
A String containing the name of this member is returned. Only the simple name is returned, not the fully qualified name. For example, for a member System.Reflection.MemberTypes.Field, the Name property would be Field.
To get the Name property:
The example listed below lists the Name and Declaring Type property of each member of the System.Empty class.
[C#]
class Mymemberinfo { public static int Main() { Console.WriteLine ("\nReflection.MemberInfo"); //Get the Type and MemberInfo Type MyType = Type.GetType("System.Empty"); MemberInfo[] Mymemberinfoarray = MyType.GetMembers(); //Get and display the DeclaringType method Console.Write("\nThere are {0} members in ", Mymemberinfoarray.Count); Console.Write("{0}.", MyType.FullName); foreach (MemberInfo Mymemberinfo in Mymemberinfoarray) { Console.Write("\n" + Mymemberinfo.Name + " declaring type - " + Mymemberinfo.DeclaringType); } return 0; } } Produces the following output Reflection.MemberInfo There are 14 members in System.Empty. Value declaring type - System.Empty GetType declaring type - System.Object . . . SetObjectData declaring type - System.Empty .cctor declaring type - System.Empty [To be supplied]
MemberInfo Class | MemberInfo Members | System.Reflection Namespace