collection.All(x=> whatever(x)) 与 collection.Any(x=>whatever(x))

命题:如果一个集合里每个元素都满足某个条件,则此任集合内至少有一个元素满足此条件.

命题错误:

 

var list = new string[0];
var all = list.All(x => x.Length == -1) ; // all == true
var any = list.Any(x => x.Length == -1); // any == false

注意, 即使如此, 仍然有以下关系成立:

!a.Any(x => whatever(x)) == a.All(x => !whatever(x))

posted on 2008-08-11 16:12  deerchao  阅读(374)  评论(0编辑  收藏  举报