C#datatable列求和,list去重,datatable某一列转list,列反序
作者:互联网
//列求和
datatable.AsEnumerable().Sum(c => (ConvertEx.ToDecimal(c["列名"]))).ToString();
//list去重
strlist = strlist.Where((x, i) => strlist.FindIndex(z => z == x) == i).ToList();
//datatable某一列转list
List<string>strlist= dtlist.AsEnumerable().Select(t => t.Field<string>("crm_name")).ToList();
//列反序
strlist.Reverse();
标签:ToList,反序,list,AsEnumerable,strlist,datatable 来源: https://www.cnblogs.com/yichen89/p/14432686.html