PC Review


Reply
Thread Tools Rate Thread

CollectionBase in Net1.1 and Collection in Net 2.0

 
 
Polo
Guest
Posts: n/a
 
      14th Feb 2005
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


 
Reply With Quote
 
 
 
 
Willy Denoyette [MVP]
Guest
Posts: n/a
 
      14th Feb 2005
CollectionBase has not changed, these overrides are still there. What makes
you think they don't exist any longer?

Willy.


"Polo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Polo
Guest
Posts: n/a
 
      14th Feb 2005
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, ...


 
Reply With Quote
 
Adam Clauss
Guest
Posts: n/a
 
      14th Feb 2005
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
(E-Mail Removed)
"Polo" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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, ...
>
>



 
Reply With Quote
 
Adam Clauss
Guest
Posts: n/a
 
      14th Feb 2005
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
(E-Mail Removed)

"Adam Clauss" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
> (E-Mail Removed)
> "Polo" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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, ...
>>
>>

>
>



 
Reply With Quote
 
Polo
Guest
Posts: n/a
 
      14th Feb 2005
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
{
.....
}
....
}


 
Reply With Quote
 
Sean Hederman
Guest
Posts: n/a
 
      14th Feb 2005
Thats because Collection is not intended to be inherited from, you're
supposed to use CollectionBase.

"Polo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
> {
> .....
> }
> ....
> }
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CollectionBase custom collection / GetChanges ? Olivier Matrot Microsoft Dot NET Framework 2 1st Sep 2006 08:41 AM
Collection object: Use CollectionBase, Generics, or DataSet _DS Microsoft C# .NET 4 31st Jan 2006 07:45 AM
Problems with custom collection (CollectionBase implementation) =?Utf-8?B?SmFubmlrIEFua2Vy?= Microsoft C# .NET 4 3rd Mar 2005 09:13 AM
collection list count (CollectionBase) list.add - problems jason@cyberpine.com Microsoft ASP .NET 3 3rd Nov 2003 05:55 PM
Building existing .NET1.1 application as .NET1.0 app Srikanth Malladi Microsoft Dot NET Framework 1 18th Jul 2003 11:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:51 PM.