Compilerwarnung (Stufe 2) CS0467Compiler Warning (level 2) CS0467

Mehrdeutigkeit zwischen der Methode „method“ und Nichtmethode „non-method“. Verwenden Sie die Methodengruppe.Ambiguity between method 'method' and non-method 'non-method'.Using method group.

Geerbte Member von anderen Schnittstellen, die die gleiche Signatur haben, führen zu einem Mehrdeutigkeitsfehler.Inherited members from different interfaces that have the same signature cause an ambiguity error.

BeispielExample

Im folgenden Beispiel wird der Fehler CS0467 generiert.The following example generates CS0467.

// CS0467.cs  
interface IList   
{  
    int Count { get; set; }  
}  

interface ICounter  
{  
    void Count(int i);  
}  

interface IListCounter : IList, ICounter {}  

class Driver   
{  
    void Test(IListCounter x)  
    {  
        // The following line causes the warning. The assignment also  
        // causes an error because you can't assign a value to a method.  
        x.Count = 1;  
        x.Count(3);     
        // To resolve the warning, you can change the name of the method or   
        // the property.  

        // You also can disambiguate by specifying IList or ICounter.  
        ((IList)x).Count = 1;  
        ((ICounter)x).Count(3);  
    }  

    static void Main()   
    {  
    }  
}