编译器错误 CS1553

更新:2007 年 11 月

错误消息

声明无效;请改用“modifier operator <dest-type> (...”

operator 的返回类型必须紧挨在参数列表之前,并且 modifier 为 implicit 或 explicit

下面的示例生成 CS1553:

// CS1553.cs
class MyClass
{
   public static int implicit operator (MyClass f)   // CS1553
   // try the following line instead
   // public static implicit operator int (MyClass f)
   {
      return 6;
   }

   public static void Main()
   {
   }
}