❔ Why doesn't every method in Collection<T> has an extension point?
For example,
But for methods like
This raises the question of why there are two ways to customize methods like
Insert calls InsertItem, and InsertItem by default calls items.Insert(index, item);(source), where items is the IList<T> instance passed into its constructor. InsertItem is also virtual. This means that to customize Collection<T>.Insert, you can either override InsertItem, or pass an IList<T> instance into the constructor of Collection<T> that has the custom behavior you want.But for methods like
Contains, there isn't an extension point like, for example, ContainsItem. That means the only way to customize Contains is to pass an IList<T> instance into the constructor of Collection<T> that has the custom behavior you want.This raises the question of why there are two ways to customize methods like
Insert, Clear, Remove, and the setter of the indexer(SetItem), while there is only one for the other methods, like the getter of the indexer and Contains. Is there any specific reason for this?