CollectionBase in Net1.1 and Collection in Net 2.0

  • Thread starter Thread starter Polo
  • Start date Start date
P

Polo

Hi,

I have some collections that inherit from CollectionBase in Net 1.1
In these collection I override the OnRemove, OnRemoveComplete, ...
I would like to to move them in Net 2.0 but in this version these protected
methods don't exist
What is the best way?

Thank's in advance
 
CollectionBase has not changed, these overrides are still there. What makes
you think they don't exist any longer?

Willy.
 
In fact the protected methods OnRemove, OnRemoveComplete don't exist in the
generic collection
I would like to move to the generic base class of my collections but in my
original collection I override the OnRemove, ...
 
I just made a quick Windows Form app in C# Express.
Added a class derived from CollectionBase and added an override for
"protected override void OnRemove(int index, object value)"

Compiled just fine. Why do you think it does not exist?
 
I just noticed the word "generic" in your post, sorry missed that.

Exactly which class are you attempting to derive from, (because
CollectionBase itself has not changed)?
 
I have :

using System.Collections;
public class MyCollection : CollectionBase
{
....
override protected void OnInsertComplete(int Index, object Value)
{
.....
}
....
}

I would like to have :

using System.Collections.Generic;
public class MyCollection : Collection
{
....
override protected void OnInsertComplete(int Index, object Value)
//This method doesn't exist
{
.....
}
....
}
 
Thats because Collection is not intended to be inherited from, you're
supposed to use CollectionBase.
 
Back
Top