Compilerfehler CS0562

Der Parameter eines unären Operators muss der enthaltende Typ sein.

Bei der Methodendeklaration für eine Operatorüberladung müssen bestimmte Richtlinien beachtet werden. Weitere Informationen finden Sie unter Operatorüberladung.

Im folgenden Beispiel wird CS0562 generiert:

// CS0562.cs  
public class iii  
{  
    public static implicit operator int(iii x)  
    {  
        return 0;  
    }  
  
    public static implicit operator iii(int x)  
    {  
        return null;  
    }  
  
    public static iii operator +(int aa)   // CS0562  
    // try the following line instead  
    // public static iii operator +(iii aa)  
    {  
        return (iii)0;  
    }  
  
    public static void Main()  
    {  
    }  
}