C#可查询的最小方法
使用Min()C#中的方法从序列中获取最小值。
以下是我们的列表。
List<long> list = new List<long> { 1, 2, 3, 4, 5, 6 };现在,使用QueryableMin()方法获取最小元素。
list.AsQueryable().Min();
示例
using System;
using System.Collections.Generic;
using System.Linq;
class Demo {
static void Main() {
List<long> list = new List<long> { 1, 2, 3, 4, 5, 6 };
foreach(long ele in list) {
Console.WriteLine(ele);
}
//获得最低元素
long min_num = list.AsQueryable().Min();
Console.WriteLine("Smallest number = {0}", mix_num);
}
}热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短