I have recently bought a book called “The c# programming language” 4th edition. On page 49 there is a reference to a List having a changed event that can be bound to as an example of events.
Have tried to reproduce this but ended up doing some head scratching with this :-
List<string> names = new List<string>();
names.Changed+= new EventHandler(ListChanged);
and so it continues….
Am I missing something or does List not have a changed event?
Indeed, it does. However, the
List<T>with aChangedevent referenced on page 49 is actually introduced on page 40. It is not theList<T>that is part of the base class library. To use the version included in the book you will have to type it in yourself (or maybe the book comes with a CD, or perhaps you can download it), and your code will not be compatible any other code that uses theSystem.Collections.Generic.List<T>that everybody else uses.