Hi!
So you want to make your collections "observable". You can use some of them provided (available) in .NET 4.0(I think that they are not available in earlier versions):
1.
ObservableCollection<T>[
^]
2.
BindingList<T>[
^] - please don't use this for your purpose...
If you don't have .NET 4.0 framework available I suggest you to use some community solution:
1.
Generic List (C#)[
^]
2.
The C5 Generic Collection Library[
^]
3.
Powercollections[
^] - Not sure that they have "event aware" collection?
Or you can write you own collection types like this...
public class YourList<T> : List<T>
{
public event System.EventHandler AddedItem;
public new void Add(T item)
{
base.Add(item);
if (AddedItem != null)
{
AddedItem(this, new EventArgs());
}
}
}
This is only stub and you need to handle all other methods that are provided by
List if you want to use this example...
Here is one more
example[
^] if you decide to implement it by yourself.