考虑一种情况,您想要检索一个List或IEnumerable多个所选复选框的值<asp:CheckBoxList>.
这是当前的实现:
IEnumerable<int> allChecked = (from item in chkBoxList.Items.Cast<ListItem>()
where item.Selected
select int.Parse(item.Value));
Run Code Online (Sandbox Code Playgroud)
问题:如何使用lambda表达式或lambda语法改进此LINQ查询?