[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

System.Collections.ICollection interface and MarshalByRefObject (Newbie question

bfung25

10/14/2004 8:50:00 PM

Hello all,

I have that common problem of wanting a class to inherit both
MarshalByRefObject and System.Collections.Collectionbase.

Since multiple inheritence is not supported in .NET and from what I
read so far in the newsgroup, I notice that the solution (correct me
if I'm wrong) is to inherit the class MarshalByRefObject and the
interface System.Collections.ICollection.

Since any interface only provides you the header of all public methods
and properties, does that mean I have to reprogram or emulate all the
functionality (ex: Count, Add, Remove) and properties of the
System.Collections.Collectionbase??? Or am I reading this wrong?

Any help will be appreciated.

Thanks!

Brian
1 Answer

Robert Jordan

10/14/2004 9:57:00 PM

0

Brian Fung wrote:

> Hello all,
>
> I have that common problem of wanting a class to inherit both
> MarshalByRefObject and System.Collections.Collectionbase.
>
> Since multiple inheritence is not supported in .NET and from what I
> read so far in the newsgroup, I notice that the solution (correct me
> if I'm wrong) is to inherit the class MarshalByRefObject and the
> interface System.Collections.ICollection.
>
> Since any interface only provides you the header of all public methods
> and properties, does that mean I have to reprogram or emulate all the
> functionality (ex: Count, Add, Remove) and properties of the
> System.Collections.Collectionbase??? Or am I reading this wrong?

You have. But you can use a concrete ICollection implementation
and delegate to that object, since ICollection isn't that huge:

public A : MarshalByRefObject, ICollection
{
ArrayList innerList;

public int Count {
get { return innerList.Count }
}

...

}

bye
Rob