Inheriting from List<T> in .NET (vb or C#)

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2011-03-05T23:16:30Z Indexed on 2011/03/05 23:24 UTC
Read the original article Hit count: 162

Filed under:
|
|

I have been delved in C++ world for a while, but now I'm in .NET world again, VB and C# and I wondered if you have a class that represents a collection of something, and you want the ability to use this in a foreach loop, etc... is it better to implement IEnumerable and IEnumerator yourself or should you inherit from the List<T> where T is the object type in it's singular form?

I know in C++ for example, inheriting from a container is considered a bad idea.

But what about .NET.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about collections