Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0558 

Error Message

User-defined operator 'operator' must be declared static and public

Both the static and public access modifiers must be specified on user-defined operators.

The following sample generates CS0558:

// CS0558.cs
namespace x
{
   public class ii
   {
      public class iii
      {
         static implicit operator int(iii aa)   // CS0558, add public
         {
            return 0;
         }
      }

      public static void Main()
      {
      }
   }
}

Community Additions

ADD
Show:
© 2015 Microsoft