好记性不如烂笔头。

ASP.NET通过反射获取实体类的属性名称和与之对应的值

/获取当前实体的所有类别
Type t = taskEN.GetType();
//获取属性列表
System.Reflection.PropertyInfo[] ps = t.GetProperties();
foreach (System.Reflection.PropertyInfo p in ps)
{
    //分别输入 属性名称及值
    str.AppendFormat("{0}: {1}<br/>", p.Name, p.GetValue(taskEN, null));
}
new 实体().GetType().GetProperty(字段名).PropertyType