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 expected
A type has not been specified where expected, when overloading an operator.
Missing type in this case means that there's no type given for the return type of the overloaded operator.
This error shouldn't be confused with missing generic type parameter.
Example
The following sample generates CS1031:
namespace x
{
public class I
{
}
public class A
{
public static operator +(A a) // CS1031 - Overloaded operator missing a type
{
return new I();
}
public static I operator +(A a) // Correct - type was specified
{
return new I();
}
}
}
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.