CollectionBase是一个提供用户自定义Collection的一个基类.
在<<.net设计规范>> 第六章一条
避免在命名基类的时候使用"Base"后缀,如果该类会用于公用ApI.
例如: CollectionBase Files(){}; 就是违反上述规范. 理由是增加"base"后缀只会对该方法的用户造成不必要的干扰.
现在在.net2.0 设计范型的集合基类命名为Collection<T>而非 CollecionBase<T>
另一个我们往往有需求就是在集合状态改变的时候通知外界,于是以前我们的做法就是继承CollectionBase,重写OnInsert(),OnInsertComplete()方法,触发事件通知外面
然而在Collection<T>范型集合类里却已找不到这样的接口,而是提供了InsertItem()这个的一个virtual方法.个人更偏好于CollectionBase这组接口,不知到2.0为何换了这样的接口.

难道要我们自己写成这样?
public class Persion

{
}
public class PersonCollection : Collection<Persion>

{
protected override void InsertItem(int index, Persion item)

{
OnFireChanging();
base.InsertItem(index, item);
OnFireChanged();
}

void OnFireChanged()

{
throw new Exception("The method or operation is not implemented.");
}

void OnFireChanging()

{
throw new Exception("The method or operation is not implemented.");
}
}

public class ClildPerionCollecion : PersonCollection

{
protected override void InsertItem(int index, Persion item)

{
OnFireChanging();
base.InsertItem(index, item);
OnFireChanged();
}

void OnFireChanging()

{
throw new Exception("The method or operation is not implemented.");
}

void OnFireChanged()

{
throw new Exception("The method or operation is not implemented.");
}
}
Collection<T> 是放在 System.Collections.ObjectModel命名空间里,而非System.Collections.Generic命名空间中不知又是基于什么理由.