考虑一个场景,您希望在<asp:CheckBoxList>
中检索所有选中的复选框的List
或IEnumerable
的值.
以下是当前的实施:
IEnumerable<int> allChecked = (from item in chkBoxList.Items.Cast<ListItem>()
where item.Selected
select int.Parse(item.Value));
Question:您将如何使用lambda表达式或lambda语法改进这个LINQ查询?