编译器错误 CS1019
更新:2007 年 11 月
错误消息
应输入可重载的一元运算符
您具有返回其他类的值的一元运算符。如果希望进行该转换,则需要进行 implicit 或 explicit 转换。
下面的示例生成 CS1019:
// CS1019.cs
public class ii
{
int i
{
get
{
return 0;
}
}
}
public class a
{
public static a operator ii(a aa) // CS1019
// try the following line instead
//public static a operator ++(a aa)
{
return new a();
}
public static void Main()
{
}
}