Does LINQ to objects stop processing Any() when condition is true?

前端 未结 5 999
醉话见心
醉话见心 2021-01-04 03:21

Consider the following:

bool invalidChildren = this.Children.Any(c => !c.IsValid());

This class has a collection of child objects that h

5条回答
  •  伪装坚强ぢ
    2021-01-04 03:48

    as per MSDN,

    The enumeration of source is stopped as soon as the result can be determined.

提交回复
热议问题