c# 使用linq查询子句方式实现 字符串数组统计操作

本文章使用的是linq查询where子句方式来实现字符串数组统计操作的。

(只是举了个简单的例子仅供参考)

linq常用子句还有:

-from 子句

-where 子句

-select 子句

-group 子句

-into 子句

-orderby 子句

-join 子句

-let 子句

-复合子句等


实例如下:

int StrArrysCount(string [] strArrys)

{

//统计strArrys数组中不为空的元素数量

return strArrys.Where(i => i != null).Count();

}