ObservableCollection(Of T) vs BindingList(Of T)?

I think your answer lies in there : http://xceed.com/CS/blogs/dontpanic/archive/2009/04/01/i-notify-we-notify-we-all-wait-no-we-don-t.aspx

To be short, ObservableCollection does not listen to changes in its children but only to Insert and Remove events.

On the other side BindingList does listen to changes and updates raised by its children. But because Binding list must listen to all its children to propagate the change notifications, it results in more memory load.

Hope this will help :)

--Bruno


Claber,

I would keep the BindingList, because BindingList supports more interfaces and more feature rich than ObservableCollection. For example:

  1. BindingList implements IList of T, whereas ObservableCollection does not.
  2. BindingList implements ICancelAddNew interface that data binding mechanisms uses for cancelling the newly added item (when you clicked escape after adding a row to DataGridView, the row will dissappear).

I'm very new to WPF myself, and don't know the specific advantages ObservableCollection offers.

Hope this helps.


Adding my two cents to an older topic:

When data binding either of these generic collections to a WinForms DataGridView and then updating properties in the source data for multiple selected rows, you'll see:

  1. The ObservableCollection<T> will only update the cell values of the most recently selected row.
  2. The BindingList<T> will update the cell values of all the selected rows.

I think they each have their advantages and disadvantages, but the above example can be a gotcha for those who are unaware of it.