prolist p1 = new prolist();
List lt = getattr(p1);
//使用泛型,返回傳入對象的屬性,名稱
public List getattr( T dx )
{
List ls = new List();
Type types = dx.GetType();
foreach (var p in types.GetProperties())
{
// p.PropertyType
ls.Add(p.Name);
}
return ls;
}
}
//實體對象
public class prolist
{
private string _pid = "0";
private string _pmoney = "0";
public string pid
{
set { this._pid = value; }
get { return this._pid; }
}
public string pmoney
{
set { this._pmoney = value; }
get { return this._pmoney; }
}
}