Convert IList<T> to BindingList<T>

Masoud picture Masoud · Feb 19, 2013 · Viewed 47.7k times · Source

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

Answer

LukeHennerley picture LukeHennerley · Feb 19, 2013
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.