DataTable dt =
new
DataTable();
var age=dt.Compute(
"avg(age)"
,
""
);
var height =dt.Compute(
"avg(height)"
,
""
);
----
DataTable.AsEnumerable().Average(x =>x.Field<int>(2));//得到平均值 x.Field<int>(2) 里面的2是第几列(age,height的列数)
string[] num = 读取条件设定.Tables["五行农历显示"].AsEnumerable().Select(d => d.Field<string>("日期")).ToArray();/*表中某列转数组*/
时间: 2024-10-06 14:10:33