473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CollectionBase in Net1.1 and Collection in Net 2.0

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
Nov 16 '05 #1
6 2858
CollectionBase has not changed, these overrides are still there. What makes
you think they don't exist any longer?

Willy.
"Polo" <pb@rtech.be> wrote in message
news:uA*************@TK2MSFTNGP10.phx.gbl...
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

Nov 16 '05 #2
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, ...
Nov 16 '05 #3
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?

--
Adam Clauss
ca*****@tamu.edu
"Polo" <pb@rtech.be> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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, ...

Nov 16 '05 #4
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)?

--
Adam Clauss
ca*****@tamu.edu

"Adam Clauss" <ca*****@nospam.tamu.edu> wrote in message
news:uU**************@tk2msftngp13.phx.gbl...
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?

--
Adam Clauss
ca*****@tamu.edu
"Polo" <pb@rtech.be> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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, ...


Nov 16 '05 #5
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
{
.....
}
....
}
Nov 16 '05 #6
Thats because Collection is not intended to be inherited from, you're
supposed to use CollectionBase.

"Polo" <pb@rtech.be> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
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
{
.....
}
....
}

Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: m. pollack | last post by:
Hi all, I've been using the CollectionBase class to implement a strongly-typed collection, but I have noticed that the RemoveAt method does not seem to call the "On" hook methods (OnRemove,...
2
by: m.pollack | last post by:
Hi all, I have an application which uses a class object that contains a collection. In order to use the PropertyGrid control to expose properties to the user at runtime, I created a...
4
by: Majed | last post by:
hi all i've created a strong named collection which inherits collection base,but when i try to add to it a nullreferenceexception blows. the code is as listed below. do i have to init the list...
1
by: Dave Veeneman | last post by:
I have created a collection class derived from CollectionBase that can be nested several layers deep. so my root object has several child objects, each of which has several grandchild objects, and...
1
by: Matthew Roberts | last post by:
Howdy Everyone, I am having trouble understanding the process of creating a type-safe collection by inheriting from the CollectionBase class. I have done it plenty of times, but now that I sit...
1
by: Kyle Novak | last post by:
I have a question about strongly typed objects when looping through a collection based on the CollectionBase object and using a For..Each loop. I have 2 objects: -Invoice: Holds all properties...
3
by: Shannon Richards | last post by:
Can anyone tell me what the CollectionBase.OnSetComplete() overridable method is supposed to be used for? MyCollectionClass(Index) = Object triggers this method but why does "setting" in a...
4
by: Kejpa | last post by:
Hi, I've begun trying out the .NET2005 beta and one thing that I was thrilled about in advance was the CollectionBase class. No more selfmade Collection classes I thought. But now I'm puzzled, I...
2
by: Samuel R. Neff | last post by:
What's the advantage of inheriting from CollectionBase as opposed to just implementing IList? It seems that it saves you from having to implement a few properties (Clear, CopyTo, Count,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.