Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1019 

Error Message

Overloadable unary operator expected

You have a unary operator that returns a value of another class. If you want this conversion, you need to do an implicit or explicit cast.

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

Community Additions

ADD
Show:
© 2014 Microsoft