Convert IList<T> to BindingList<T>
Asked Answered
C

1

29

How can I cast an IList<Customer> list to BindingList<Customer>?

Countertenor answered 19/2, 2013 at 8:59 Comment(0)
A
101
var yourList = new List<Customer>();
var listBinding = new BindingList<Customer>(yourList);

BindingList Constructors

You don't need to do a cast, just provide the BindingList<T> class constructor with IList<T>, which you have.

Abbreviate answered 19/2, 2013 at 9:1 Comment(1)
Since there is no ToBindingList() method with LINQ, can you answer the question for those cases? something like this: BindingList<cRecord> cr = cRecords.Take(TotalDays).ToList();Melanochroi

© 2022 - 2024 — McMap. All rights reserved.