Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'Type 1': return type must be 'Type 2' to match overridden member 'Member Name'
An attempt was made to change the return type in a method override. To resolve this error, make sure both methods declare the same return type.
Example
The following sample generates CS0508.
// CS0508.cs
// compile with: /target:library
abstract public class Clx
{
public int i = 0;
// Return type is int.
abstract public int F();
}
public class Cly : Clx
{
public override double F()
{
return 0.0; // CS0508
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.