I have a List<MyList>
of objects.
MyList
also has in it several Lists and one might be called List<Defect>
.
List<Defect>
can contain multiple defects one or more of which might be null.
How can I return a count of MyList items where MyList.Defects contains a null object?
I know I can do a foreach and check every item but is there a LINQ way to do this?
How can I return a count of MyList items where MyList.Defects contains a null object?
return myLists.Count(ml => ml.Defects.Contains(null));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With