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.
EDIT:
It seems my question was slightly misunderstood. I am not unhappy at all with existing collections in .NET. Here is my problem, I have a class called 'Person' and I need a collection called 'Scouts', which I want in an Class called 'Scouts', at this point I'd like to be able to write
foreach Person in Scouts ...
What is the best way to get this Scouts as a collection of People, and be able to use it in a foreach loop?
Scoutswould be the name of a variable or property, not type. Therefore, you'll be perfectly ok declaringpublic List<Person> Scouts { get; set; }, and then goingforeach( var person in Scouts ) ...