Jumat, 09 November 2007

Property Info

namespace PropertyInfossss
{
public class Test
{
private string _Test;
public string Name
{
get { return _Test; }
set { _Test = value; }
}
}
class Program
{


static void Main(string[] args)
{
PropertyInfo a=typeof(Test).GetProperty("Name");
Console.WriteLine("Read:" + a.CanRead + " Write:" + a.CanWrite + " Type:" + a.PropertyType);
MethodInfo theSetMethod = a.GetSetMethod();
MethodInfo theGetMethod = a.GetGetMethod();
MethodBody theSetMethodBody= theSetMethod.GetMethodBody();
MethodBody theGetMethodBody= theGetMethod.GetMethodBody();


}
}

Tidak ada komentar: