public List<FF_ThicknessDataEntity> listchange(FF_ThicknessPostData ff_thicknesspostdata, string FF_ProductionInformationId)
{
List<FF_ThicknessDataEntity> lists = new List<FF_ThicknessDataEntity>();
Type t = ff_thicknesspostdata.GetType();//获得该类的Type
//再用Type.GetProperties获得PropertyInfo[],然后就可以用foreach 遍历了
foreach (PropertyInfo pi in t.GetProperties())
{
object value1 = pi.GetValue(ff_thicknesspostdata, null);//用pi.GetValue获得值
string name = pi.Name;
//获得属性的名字,后面就可以根据名字判断来进行些自己想要的操作
//获得属性的类型,进行判断然后进行以后的操作,例如判断获得的属性是整数
//if (value1.GetType() == typeof(int))
//{
// //进行你想要的操作
//}
for (int i = 0; i < 20; i++)
{
if (Convert.ToInt16(name.Substring(name.Length - 2)) == (i + 1))
{
FF_ThicknessDataEntity FF_ThicknessDataEntity = new FF_ThicknessDataEntity();
FF_ThicknessDataEntity.FF_ThicknessReal = Convert.ToDecimal(value1);
FF_ThicknessDataEntity.FF_ProductionInformationId = FF_ProductionInformationId;
FF_ThicknessDataEntity.FF_OrderNumber = i + 1;
lists.Add(FF_ThicknessDataEntity);
}
}
}
return lists;
}