I am trying to get CheckedListBox.CheckedItems
as a StringList. But I don't know how to get it. I am trying to make it as a one liner using LINQ. My insufficient experience in .Net-C# is not capable to do that. Can anybody say how to do that?
Note: I am using .Net-4.0.
If the values you stored in those items are strings:
List<string> items = chk.CheckedItems.Cast<string>().ToList();
If they are of some custom type you could use that type:
List<SomeTypeUsedForTheItems> items = chk.CheckedItems.Cast<SomeTypeUsedForTheItems>().ToList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With