M_People mp = new M_People();
mp.PL_Age = 30;
mp.Pl_ID = "001";
mp.Pl_LoginName = "Test1";
mp.PL_Pwd = "123";
mp.Pl_Sex = "Female";
mp.Pl_TrueName = "Mary";
foreach (System.Reflection.PropertyInfo p in mp.GetType().GetProperties())//获取属性
{
Console.WriteLine("Name:{0} Value:{1}", p.Name, p.GetValue(mp, null));
}
//p.SetValue(mp, "Value", null); 赋值*/
public class M_People
{
string _Pl_ID;
public string Pl_ID
{
get { return _Pl_ID; }
set { _Pl_ID = value; }
}
int _PL_Age;
public int PL_Age
{
get { return _PL_Age; }
set { _PL_Age = value; }
}
string _Pl_Sex;
public string Pl_Sex
{
get { return _Pl_Sex; }
set { _Pl_Sex = value; }
}
string _Pl_LoginName;
public string Pl_LoginName
{
get { return _Pl_LoginName; }
set { _Pl_LoginName = value; }
}
string _Pl_TrueName;
public string Pl_TrueName
{
get { return _Pl_TrueName; }
set { _Pl_TrueName = value; }
}
string _PL_Pwd;
public string PL_Pwd
{
get { return _PL_Pwd; }
set { _PL_Pwd = value; }
}
}