c#使用映射 提取list的某个属性的全部数据
List<T> coorlist = new List<T>();
PropertyInfo[] PropertyList = coorlist[0].GetType().GetProperties();
foreach (PropertyInfo item in PropertyList)
{
string name = item.Name;
var thisvalue = jhbx.Select(p => p.GetType().GetProperty(name).GetValue(p))
.Distinct().ToList();
}
thisvalue就是list中单独属性的所有数据的集合,自己保存数据就行。