A类实现ICOMPARE接口。
b集合类重载add方法,在基类调用add之前进行重复性检查,有则报错。

解决方案 »

  1.   

    seeWriting Type-Safe Collections in C#
    http://www.ondotnet.com/pub/a/dotnet/2003/03/10/collections.html?page=1or
    Walkthrough: Creating Your Own Collection Class
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vaconCreatingYourOwnCollectionClass.asp
      

  2.   

    在把一个A实例填加到B中时,要检测在B集合的已经存在的A实理中是否存在有具有相同KEY值的A实例,有则报错!!!应该可以用反射实现。