Hi
How to override Add Method of List<> ?
public class ccCity : List
{
public cCity this[string name]
{
get
{
foreach (cCity item in this)
{
if (item.cvrName==name)
{
return item;
}
}
return null;
}
}
public new void Add(cBaseCVR cvr)
{
this.Add(cvr);
}
}
thanks

Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 23, 2015, 8:00 PM EDT
Hi,
Add method is define in ICollection interface and for the list it is not virtual so we cannot override...
instead of you can implement Icollection interface in your class.
hope this will help you.