When I programin C#, there are times I need a strongly typed collection:
I often create a class that inherits from the ArrayList
:
using System.Collections;
public class Emails: ArrayList
{
public new Email this[int i]
{
get
{
return (Email)base[i];
}
set
{
base[i] = value;
}
}
}
I realize this is probably not the correct way to inherit from a collection. If I want to inherit from a strongly typed collection in C#, how should I do it, and what class should I choose to inherit from?