Collection interfaces

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Confused about this concept. If I define some collection class and inherit
IList, I get an error if I don't implement the interface methods. This
makes sense.

But if I inherit from CollectionBase, I don't get this error, yet the
methods still don't seem to be implemented. For example, this code gives a
compile error.

class TestColl : IList
{
}

because, for one, it doesn't implement Add(...)

But this one does not give an error, even though the source for
CollectionBase shows that it does not implement Add(...) either.

class TestColl : CollectionBase, IList
{
}

What concept am I missing here?


.



Relevant Pages

  • Re: Reference going missing in Remoted Object
    ... Peter - I have tried amending the MicroHub to inherit off MarshalByRefObject. ... However I think the problem is more related to CollectionBase. ...
    (microsoft.public.dotnet.general)
  • Re: Collection interfaces
    ... I get an error if I don't implement the interface methods. ... CollectionBase shows that it does not implement Addeither. ... class TestColl: CollectionBase, IList ... What concept am I missing here? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Collection interfaces
    ... nooboy wrote: ... I get an error if I don't implement the interface methods. ... But if I inherit from CollectionBase, I don't get this error, yet the ... They're implemented by CollectionBase, but explicitly. ...
    (microsoft.public.dotnet.languages.csharp)
  • Serialization Performance (again)
    ... spent on WriteArrayMember. ... I have around 15 classes that inherit from ... CollectionBase. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Collection interfaces
    ... I get an error if I don't implement the interface methods. ... But if I inherit from CollectionBase, I don't get this error, yet the ... They're implemented by CollectionBase, but explicitly. ... if you cast a CollectionBase to IList, ...
    (microsoft.public.dotnet.languages.csharp)