[.net] Overriding Clear() in CollectionBase

Started by
0 comments, last by Donavon Keithley 19 years, 8 months ago
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.

------------------------------- Goblineye Entertainment------------------------------

Advertisement
Looks like a doc bug. It's not virtual.

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.
Donavon KeithleyNo, Inky Death Vole!

This topic is closed to new replies.

Advertisement