You can't always cast any collection type into any other collection. In terms of when the the compiler checks casting, check out this post on Compile-time vs runtime casting
However, you can easily produce a BindingList
from an enumerable by doing some of the plumbing yourself. Just add the following Extension Method onto any Enumerable type to convert the collection into a BindingList.
C#:
<!-- language: lang-cs -->
static class ExtensionMethods
{
public static BindingList<T> ToBindingList<T>(this IEnumerable<T> range)
{
return new BindingList<T>(range.ToList());
}
}
//use like this:
var newBindingList = (from i in new[]{1,2,3,4} select i).ToBindingList();
VB:
<!-- language: lang-vb -->
Module ExtensionMethods
<Extension()> _
Public Function ToBindingList(Of T)(ByVal range As IEnumerable(Of T)) As BindingList(Of T)
Return New BindingList(Of T)(range.ToList())
End Function
End Module
'use like this:
Dim newBindingList = (From i In {1, 2, 3, 4}).ToBindingList()