I would like to have a LINQ statement that calls the IsValid property.If all the elements are true, I want the operator to return true as well.How can I do that?
var allValid = myList.All(item => item.IsValid);
You need the Enumerable.All <TSource> method:
bool everythingsZen = anEnumerable.All(a => a.IsValid);
, . Enumerable.All true,
var allValid = myList.Any() && myList.All(item => item.IsValid);
Enumerable.All true ?
Source: https://habr.com/ru/post/1752553/More articles:Convert SQL to ACCESS - sqlΠΠΊΠ½ΠΎ, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π±ΡΡΡ ΠΏΠΎΠ»Π½ΠΎΡΠΊΡΠ°Π½Π½ΡΠΌ Π² ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠΈ Ρ ΡΠ΅Π½ΡΠΎΡΠ½ΡΠΌ ΡΠΊΡΠ°Π½ΠΎΠΌ WPF, ΠΏΠ΅ΡΠ΅ΠΌΠ΅ΡΠ°Π΅ΡΡΡ ΠΏΡΠΈ ΠΏΡΠΎΠΊΡΡΡΠΊΠ΅ Π²Π½ΡΡΡΠ΅Π½Π½Π΅Π³ΠΎ ΡΠΏΠΈΡΠΊΠ° - vb.netRunning R on Ubuntu Netbook needs help with graphic device size - rNeed help with proper SQL - mysqlΠΠΎΠ½ΡΠ»ΠΈΠΊΡ ΠΌΠ΅ΠΆΠ΄Ρ Π΄Π²ΡΠΌΡ ΠΏΠ»Π°Π³ΠΈΠ½Π°ΠΌΠΈ jQuery? - javascript$ .getJSON (jQuery) not working in IE 8 - javascriptboost :: iterator_facade and std :: find (...) - c ++How can I get ORM to work with two separate databases without the foriegn keys defined in the tables? - phpDjango custom field - automatically adds COLLATE to the request - djangoHow does the click () function in jquery work when working with multiple glass divs? - javascriptAll Articles