Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1553

Declaration is not valid; use 'modifier operator <dest-type> (...' instead

The return type for an operator must immediately precede the parameter list, and modifier is either implicit or explicit.

The following sample generates 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()

Community Additions

© 2014 Microsoft