//需要获取最大最小平均值的数组 //结果数组仅仅包含三个元素
public static void GetMaxMinAvgValue(string [] TempArray, string[] arrResult )
{
if (TempArray.Length == 0) //如果数组为空,结果数组返回空值
{
arrResult[0] = "";
arrResult[1] = "";
arrResult[2] = "";
return ;
}
List<double> lTmp = new List<double>();
double dTmp;
foreach (string strTmp in TempArray)
{
if (double.TryParse(strTmp, out dTmp) == true) //如果是数字就将值填入一个列表
{
lTmp.Add(double.Parse(strTmp));
}
}
arrResult[0] = lTmp.Max().ToString("0.0"); //利用列表求最大 最小 平均值
arrResult[1] = lTmp.Min().ToString("0.0");
arrResult[2] = lTmp.Average().ToString("0.0");
return ;
}