LINQ Any()

Enumerable.Any 方法

确定序列中的任何元素是否存在或满足条件。

源码如下:

public static bool Any<TSource>(this IEnumerable<TSource> source) {
            if (source == null) throw Error.ArgumentNull("source");
            using (IEnumerator<TSource> e = source.GetEnumerator()) {
                if (e.MoveNext()) return true;
            }
            return false;
        }

 

posted @ 2021-09-28 17:10  vba是最好的语言  阅读(129)  评论(0编辑  收藏  举报