通用最小方法 [英] Generic minimum method
本文介绍了通用最小方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个通用列表,其中包含许多行:
Client.add(新客户端(名称,地址,电话........,a数量));
我有大约100个这些我想取数字的值并看到它的最小值
I have a generic list with many lines like that :
Client.add (new client ( "name" , "adress","phone " ........ , a number ));
I have about 100 of these i want to take the value of the number and see the minimum value of it
推荐答案
使用LINQ Min方法。
Use LINQ Min method.
var a = new dynamic[] {new {a ="a", n = 10},new {a ="b", n = 5},new {a ="c", n = 6},new {a ="d", n = 2}};
int min = a.Min(x => x.n);
Console.Write(min);
int min = Client.Min(client => client.a_number);
[ ^ ]
这篇关于通用最小方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文