Good afternoon, I have a sheet with some objects that have a bool field isAlive.


Is it possible to see the values ​​of all objects with one Linq query?


For example, check whether all objects are "dead" / "alive":

bool isAllAlive = list.// Linq запрос. 

    1 answer 1

    When nothing helps, read the documentation at last!

    In this case, the All and Any methods are useful to you:

     bool isAllAlive = list.All(x => x.IsAlive);