字段反射

List<string> FieldListAll = "D1,D2,Tn1,Tn2,A,B,C".ToList();
List<string> FieldList = new List<string>();
foreach (string Field in FieldListAll)
{
double val = (double)this.GetType().GetField("d" + Field).GetValue(this);

if (val>0)
{
FieldList.Add(Field);
}
}

原文地址:https://www.cnblogs.com/swtool/p/8834385.html