views:

91

answers:

1

I have a my custom collection derived from List(.MyItem.)

I want to trace if my collection is modified, how can I do that?

I am able to track Add Remove operations etc...by implement new definition of them but I don't see any method in List that gives me opportunity to track if collection is modified...

+6  A: 

Take a look at a new type called ObservableCollection<T>. It has built in notification of changes, and it should be fairly simple to change your base class to this from list as both are very similar.

Jerry Bullard
When you say "new" - it's been around since .NET 3.0...
Jon Skeet
The VS2008 not able to recognize ObservableCollection<T>..I have included the namespace using System.Collections.Generic;I see only three collection under System.Collection.ObjectModel:1.Collection2.Keyed Collection3.ReadOnlyCollection..what am I missing ???????
Ashish Ashu
Add a reference to WindowsBase.dll.
Blindy
Thanks Blindy!!
Ashish Ashu
@Skeet: Relatively new, that is. If it weren't, he wouldn't be asking this question, and no one would need to point him at the correct assembly. But, thanks anyway for the "Skeet bump". :-)
Jerry Bullard