Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 2) CS0467

Ambiguity between method 'method' and non-method 'non-method'. Using method group.

Inherited members with same signature, from different interfaces, cause ambiguity error.

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)
    {
        x.Count = 1;
        x.Count(1);   // CS0467
        // To resolve change the method name "Count" to another name.
    }
    
    static void Main() 
    {
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft