I think you need to look for SOLID software development principles, in particular the Liskov Principle of Replacement .
You asked why the interface INotifyCollectionChangedalso does not extend the interface IList. Let me answer it with a counter using the Liskov Subscription Principle:
, INotifyCollectionChanged - IList?
, :
INotifyCollectionChanged , , , , , , IList ICollection, IEnumerable, . IList, ICollection indexer
NotifyPropertyChangedEventArgs (, , NotifyCollectionChangedEventArgs), , , . , IList. , , .
, .
, , INotifyCollectionChanged:
public class MyCustomCollection : INotifyCollectionChanged
{
private readonly IList<int> _ints;
public MyCustomCollection()
{
_ints = new List<int>();
}
public event NotifyCollectionChangedEventHandler CollectionChanged;
public void AddInt(int i)
{
_ints.Add(i);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Move,
(IList)_ints,
_ints.Count,
_ints.Count - 1));
}
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
{
var handler = CollectionChanged;
if (handler != null)
{
handler(this, e);
}
}
}
, .