I've tried a lot of things but the most logical one for me seems this one:
int divisor = AllMyControls.Take(p => p.IsActiveUserControlChecked).Count();
AllMyControls
is a Collection of UserControls
, what I want to know is how many UserControls
have the IsActiveUserControlChecked
property set to true.
What I get in VS is:
Cannot convert lambda expression to type 'int' because it is not a delegate type
What's wrong with my expression?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…