6

In the documentation of the event args of NotifyCollectionChangedEventArgs, there is an action called Replace (in addition to Add, Remove, Move, etc.). When can this be fired? I can't see any Replace method in ObservableCollection

Louis Rhys
  • 30,777
  • 53
  • 137
  • 211

1 Answers1

8

Here is an example:

ObservableCollection<string> myCollection = new ObservableCollection<string>;
myCollection.Add("One");
myCollection.Add("Two");
myCollection.Add("Three");
myCollection.Add("Four");
myCollection.Add("Five");

myCollection[4] = "Six"; // Replace (i.e. Set)
CodeNaked
  • 38,487
  • 6
  • 108
  • 141