日期:2014-05-17 浏览次数:20861 次
static void Main(string[] args)
{
List<object> list = new List<object>() { 11.21, 33.43, 666.12121, 121, 987.12, "string" };
double maxValue = list.OfType<double>().Max<double>();
Console.WriteLine(maxValue);//输出987.12
}
static void Main(string[] args)
{
List<object> list = new List<object>() { 11.21, 33.43, 666.12121, 121, 987.12 };
List<double> listDouble = list.Select(x => Double.Parse(x.ToString())).ToList();
double maxValue = listDouble.Max();
Console.WriteLine(maxValue);
}