[.net] Overriding Clear() in CollectionBase
how come i cant override the public virtual method 'Clear()' of the System.Collections.CollectionBase class?
when im trying to override it im getting that error:
"C:\Documents and Settings\Roy\My Documents\Visual Studio Projects\WebEngine\Class1.cs(49): 'Goblineye.Projects.WebEngine.EditorCollection.Clear()' : cannot override inherited member 'System.Collections.CollectionBase.Clear()' because it is not marked virtual, abstract, or override"
however, the method does declared as virtual...
here's the method declaration (provided by MSDN):
public virtual void Clear();
i would be grateful for any help.
Looks like a doc bug. It's not virtual.
However the implementation looks like this:
OnClear and OnClearComplete are protected virtual, so the idea is that you override these methods.
HTH.
However the implementation looks like this:
public void Clear(){ this.OnClear(); this.InnerList.Clear(); this.OnClearComplete();}
OnClear and OnClearComplete are protected virtual, so the idea is that you override these methods.
HTH.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement