This member is a field.
using System;
using System.Reflection;
public class Myfield
{
private string field = "a private field";
public string Field
{
get{return field;}
}
}
public class Myfieldinfo
{
public static int Main()
{
Myfield Myfield = new Myfield();
Type MyType = typeof(Myfield);
FieldInfo Myfieldinfo = MyType.GetField("field", BindingFlags.NonPublic|BindingFlags.Instance);
Console.Write ("\n{0}.", MyType.FullName);
Console.Write ("{0} - ", Myfieldinfo.Name);
Console.Write ("{0};", Myfield.Field);
MemberTypes Mymembertypes = Myfieldinfo.MemberType;
Console.Write("MemberType is a {0}.", Mymembertypes.ToString());
return 0;
}
}
Related examples in the same category