Masoud
Masoud

Reputation: 8181

Convert IList<T> to BindingList<T>

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

Upvotes: 29

Views: 58809

Answers (1)

LukeHennerley
LukeHennerley

Reputation: 6444

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.

Upvotes: 102

Related Questions