E
Eric Johannsen
I have a simple object that inherits from CollectionBase and overrides the
Count property:
namespace MyTest
{
public class CollTest : System.Collections.CollectionBase
{
public override int Count
{
get { return 0; }
}
}
}
The compiler seems to think the Count method in the base class is not marked
virtual:
C:\develop\GUITest\CollTest.cs(12): 'GUITest.CollTest.Count.get' : cannot
override inherited member 'System.Collections.CollectionBase.Count.get'
because it is not marked virtual, abstract, or override
However the help in VS.Net claims otherwise:
CollectionBase.Count Property [C#]
Gets the number of elements contained in the CollectionBase instance.
public virtual int Count {get;}
Any thoughts on why the override keyword is being rejected? Is the correct
approach to use the new keyword instead? This has different symantics and
is not preferred from our design point of view.
Thanks!
Count property:
namespace MyTest
{
public class CollTest : System.Collections.CollectionBase
{
public override int Count
{
get { return 0; }
}
}
}
The compiler seems to think the Count method in the base class is not marked
virtual:
C:\develop\GUITest\CollTest.cs(12): 'GUITest.CollTest.Count.get' : cannot
override inherited member 'System.Collections.CollectionBase.Count.get'
because it is not marked virtual, abstract, or override
However the help in VS.Net claims otherwise:
CollectionBase.Count Property [C#]
Gets the number of elements contained in the CollectionBase instance.
public virtual int Count {get;}
Any thoughts on why the override keyword is being rejected? Is the correct
approach to use the new keyword instead? This has different symantics and
is not preferred from our design point of view.
Thanks!