Creating a string-array of checked items in checked-list-box

Assuming your using 3.5 or above..

object[] items = lb.CheckedItems.OfType<object>().ToArray();

And if you are adding a specific type of object to the CheckedListBox then you can replace object with the name of the class you use.


Hi i am doing a similar kind of task . But instead of array i am using array list . I used the below code

ArrayList errorList = new ArrayList();
errorList = chklbErrorlist.CheckedItems.OfType<object>().ToList();

Cannot implicitly convert type System.Collections.Generic.List<object> to System.Collections.ArrayList

I added the items to the array and then added to the arraylist, It worked. How to add items directly to the araaylist instead of the array