Edit

Share via


Compiler Error CS0057

Inconsistent accessibility: parameter type 'type' is less accessible than operator 'operator'

A public construct must return a publicly accessible object. For more information, see Access Modifiers.

The following sample generates CS0057:

// CS0057.cs  
class MyClass //defaults to private accessibility  
// try the following line instead  
// public class MyClass  
{  
}  
  
public class MyClass2  
{  
   public static implicit operator MyClass2(MyClass iii)   // CS0057  
   {  
      return new MyClass2();  
   }  
  
   public static void Main()  
   {  
   }  
}