behzad pakniyat

behzad pakniyat

  • 1.6k
  • 105
  • 10.5k

How to override Add Method of List<> ?

Jun 23 2015 2:13 PM
Hi
 
How to override Add Method of List<> ?
 
public class ccCity : List<cCity>
{
   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 

Answers (1)