It's easy to cast a Listbox.ObjectCollection to a list to perform enumerations on but what about if you want to go the other way? I KNOW YOU CAN USE A FOREACH( Like
Now
works find but what if I want to now convert the_domains? I've tried a simple case like
This works but it gets generates a exception.
foreach (string d in the_domains) { this.dList.Add(d); }
Now
var the_domains = domains.Items.Cast<string>().Where(item => (item.Contains("Is Available"))); foreach (string d in the_domains) { this.lstbx_domains.Items.Add(d); }
works find but what if I want to now convert the_domains? I've tried a simple case like
(Listbox.ObjectCollection)the_domains
This works but it gets generates a exception.