Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error CS1019
Collapse the table of content
Expand the table of content

Compiler Error CS1019

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()
   {
   }
}
Show:
© 2015 Microsoft