I am adding functionality to an existing .Net collection. In order to do this, I am overriding several functions. I have not been able to override the return value of the basic array return in the collection. For example, if I call emailMessage.To[i], it does not return the proper value, but if I call emailMessage.Item(i), it returns the correct value. Below is the code from my class. What do I need to override to correct the first error?
namespace EmailService
{
public class MailAddressCollection : System.Net.Mail.MailAddressCollection
{
public MailAddressCollection() : base()
{
}
public void Add(MailAddress Address)
{
base.Add(Address);
}
public MailAddress Item(int index)
{
return (MailAddress)(base.Items[index]);
}
}
}