Edit

Share via


Compiler Error CS0554

'conversion routine' : user defined conversion to/from derived class

User-defined conversions to values of a derived class are not allowed; you do not need such an operator.

See chapter 6 in the C# language specification for more information on user-defined conversions.

The following sample generates CS0554:

// CS0554.cs  
namespace x  
{  
   public class ii  
   {  
      // delete the conversion routine to resolve CS0554  
      public static implicit operator ii(a aa) // CS0554  
      {  
         return new ii();  
      }  
   }  
  
   public class a : ii  
   {  
      public static void Main()  
      {  
      }  
   }  
}