Consider a scenario where you want to retrieve a List
or IEnumerable
of the values of all the selected checkboxes in an <asp:CheckBoxList>
.
Here's the current implementation:
IEnumerable<int> allChecked = (from item in chkBoxList.Items.Cast<ListItem>()
where item.Selected
select int.Parse(item.Value));
Question: How would you improve this LINQ query using a lambda expression or lambda syntax?