Reputation: 2101
I have many classes sharing a interface.I have also created a BindingList consist of objects created from these classes.
Now i want to use this binding list as a Datasource for a Datagridview.
would this work?can please someone give me some example.
Upvotes: 1
Views: 1364
Reputation: 15569
Oh wait - can you just create a BindingList of IMyInterface ?
myList = new List<IMyInterface>();
myList.Add(new Foo());
myList.Add(new Bar());
myDataGridView.DataSource = myList;
Foo and Bar implement IMyInterface
Upvotes: 2