Compiler Error CS1554
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Compiler Error CS1554

Declaration is not valid; use '<type> operator op (...' instead

The return type for a user-defined operator must appear before the keyword operator.

The following sample generates CS1554:

// CS1554.cs
class MyClass
{
   public static operator ++ MyClass (MyClass f)    // CS1554
   // try the following line instead
   // public static MyClass operator ++ (MyClass f)
   {
      return new MyClass ();
   }

   public static void Main()
   {
   }
}
Show:
© 2016 Microsoft