Count()
函数用于计算列表中的项的数量。
语法
int[] Num = { 5,4,3,2,1};
int Count = Num.Count();
Dim Num As Integer() = {5,4,3,2,1}
Dim Count As Integer = Num.Count()
上述语法,使用LINQ Count()函数来计算 “Num “列表中的项目总数。
13、如何计算列表或集合中的元素?
Count()
函数用于计算列表中的项的数量。
语法
int[] Num = { 5,4,3,2,1};
int Count = Num.Count();
Dim Num As Integer() = {5,4,3,2,1}
Dim Count As Integer = Num.Count()
上述语法,使用LINQ Count()函数来计算 “Num “列表中的项目总数。