我尝试了很多东西,但对我来说最符合逻辑的是这个:
int divisor = AllMyControls.Take(p => p.IsActiveUserControlChecked).Count();
Run Code Online (Sandbox Code Playgroud)
AllMyControls是一家集的UserControls,我想知道的是有多少UserControls有IsActiveUserControlChecked属性设置为true.
我在VS中获得的是:
Cannot convert lambda expression to type 'int' because it is not a delegate type
Run Code Online (Sandbox Code Playgroud)
我的表情有什么问题?