I have this code for casting CheckedListBox.Items
to List<Item>
:
List<Item> items = ChkLsBxItemsToDraw.Items as List<Item>;
and this is my Item
Class
public class Item
{
public List<double> x = new List<double>();
public List<double> y = new List<double>();
}
I set CheckedListBox.DataSource
to a List<Item>
and I got this Error:
Error 1 Cannot convert type '
System.Windows.Forms.CheckedListBox.ObjectCollection
' to 'System.Collections.Generic.List<Drower.Item>
' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
How Can I get the CheckedListBox.Items
as List<Item>
???
List<Item> items = this.ChkLsBxItemsToDraw.Items.Cast<Item>().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