I have a general list. it has a ListfilesToProcess.Count property that returns the total number of elements, but I want to count a certain number of elements in a list with a conditional expression.
I do it like this:
int c = 0; foreach (FilesToProcessDataModels item in ListfilesToProcess) { if (item.IsChecked == true) c++; }
Is there a shorter way, for example, int c = ListfilesToProcess.count (item => item.IsChecked == true);
source share