I have a Generic List. it has a ListfilesToProcess.Count property which returns total number of items, but I want to count certain number of items in list with conditional-statement.
I am doing it like this:
int c = 0;
foreach (FilesToProcessDataModels item in ListfilesToProcess)
{
if (item.IsChecked == true)
c++;
}
Is there any shorter way like int c = ListfilesToProcess.count(item => item.IsChecked == true);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…