I have a method very similar to the example below, and it won't let me out
the outItem
.
public override bool myMethod(string item, out string outItem)
{
outItem = "";
return true;
}
It keeps giving the the following error:
"no suitable method found to override"
If I remove the override
, the error goes away. How can I fix this problem?
It would appear that the method in the base class doesn't mark that parameter as
out
. You need to conform to the base class's signature. If you can change the base class to mark the method asout
, then you can mark it as such on the derived type as well. If you can't, then you won't be able to override the method, you'll have to create a new method instead.