I have used the Entity framework to populate a checked list box. I want to get the names of the checked items as a string collection so that they can then be used as a filter for another LINQ query.
I populate the list box like this…
_eventTypesCheckedList.DataSource = this._dataContext.tblEventTypes.OrderBy(ev => ev.EventTypeName);
_eventTypesCheckedList.DisplayMember = "EventTypeName";
This is how I’m failing to get the string collection…
var types = from eType in ((_eventTypesCheckedList.CheckedItems) as IEnumerable< tblEventType > )
select new string( eType.EventTypeName.ToCharArray() );
Any help would be great.
Cast your
CheckItemscollection using.Cast<Type>()extension method: