C# MemberInfo Name

Description

MemberInfo Name Gets the name of the current member.

Syntax

MemberInfo.Name has the following syntax.


public abstract string Name { get; }

Example


using System;/*  ww w  . ja  v  a  2  s.co m*/
using System.Reflection;

class Mymemberinfo
{
    public static int Main()
    {
        Type MyType = Type.GetType("System.Empty");
        MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
        Console.Write(Mymemberinfoarray.GetLength(0));
        Console.Write("{0}.", MyType.FullName);

        foreach (MemberInfo Mymemberinfo in Mymemberinfoarray)
        {
            Console.Write("\n" + Mymemberinfo.Name
                + " declaring type - " +
                Mymemberinfo.DeclaringType);
        }
        return 0;
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo