Reading Type Information using reflection

muralikrishnasurap-12704
Posted by muralikrishnasurap-12704 under ASP.NET category on | Points: 40 | Views : 737
class Program
{
static void Main(string[] args)
{
Type_type = typeof(TestClass);
FieldInfo[] _filedInfo =_type.GetFields();
foreach(FieldInfo field in _filedInfo)
{
Console.WriteLine("Display fields name" + field + "\n");
}

MethodInfo[] _methodinfo =_type.GetMethods();
foreach(MethodInfo method in _methodinfo)
{
Console.WriteLine("Display Method name: " + method + "\n");
}
Console.Read();
}
}
class TestClass
{
public decimal EMPSalary = 0;
public string EMPName = "EmployeName";

public void PublicMethod()
{
}
privatevoid PrivateMethod()
{

}
internalvoid InternalMethod()
{

}
protectedvoid ProtectedMethod()
{

}
}

Comments or Responses

Login to post response