Why Collection Remove() methods are not overridden?

May 15, 2014 at 10:44 AM
I have generated code for windows forms and in my collection class, remove method is generated like this:
        public new bool Remove(OfficeEC item)
            if (!CanDeleteObject())
                throw new System.Security.SecurityException("User not authorized to remove a OfficeEC.");

            return base.Remove(item);
Why new keyword is used in this method? When I remove an item from the binding source, it does not call this method, rather Remove() method of base class is called.. It appears that I will have to override these methods manually. Any comments?
May 26, 2014 at 9:41 AM
Edited May 26, 2014 at 9:41 AM
Hi Malik Abbas,

As you may have found by now, you can't override this method. That's why it's marked as new. You are right, databinding doesn't call this method nor the method
public new bool Add(OfficeEC item)
Those methods were added to be used by other generated methods like
public void Remove(int OfficeECid)

public DocClassEdit Add()

public void BeginAdd()