I am trying to create a BindingList<> from anonymous type returned by LINQ query but BindingList<> do not accept anonymous type, following is my code
v
You can write an extension method:
static class MyExtensions { public static BindingList ToBindingList(this IList source) { return new BindingList(source); } }
and use it like this:
var query = entities .Select(e => new { // construct anonymous entity here }) .ToList() .ToBindingList();