Avertissement du compilateur (niveau 2) CS0467

Ambiguïté entre la méthode 'method' et l’élément 'non-method' qui n’est pas une méthode. Utilisation du groupe de méthodes.

Les membres hérités de différentes interfaces avec la même signature provoquent une erreur d’ambiguïté.

Exemple

L’exemple suivant génère l’avertissement du compilateur 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 can also disambiguate by specifying IList or ICounter.  
        ((IList)x).Count = 1;  
        ((ICounter)x).Count(3);  
    }  
  
    static void Main()
    {  
    }  
}