PhysiqueOutModel physiqueOutModel = new PhysiqueOutModel ();//自定義對象
Type t = physiqueOutModel.GetType();//獲得該類的Type
foreach (PropertyInfo pi in t.GetProperties())
{
string name = pi.Name;//獲得屬性的名字,后面就可以根據名字判斷來進行些自己想要的操作
var value = pi.GetValue(physiqueOutModel, null);//用pi.GetValue獲得值
string newVal = "新值";
pi.SetValue(physiqueOutModel, newVal);//設置屬性值
}