Compiler Error CS0229

 

Updated: July 20, 2015

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Ambiguity between 'member1' and 'member2'

Members of different interfaces have the same name. If you want to keep the same names, you must qualify the names. For more information, see Interfaces.

System_CAPS_ICON_note.jpg Note

In some cases, this ambiguity can be resolved by providing an explicit prefix to the identifier via a using alias.

The following example generates CS0229:

// CS0229.cs  
  
interface IList  
{  
    int Count  
    {  
        get;  
        set;  
    }  
  
    void Counter();  
}  
  
interface Icounter  
{  
    double Count  
    {  
        get;  
        set;  
    }  
}  
  
interface IListCounter : IList , Icounter {}  
  
class MyClass  
{  
    void Test(IListCounter x)  
    {  
        x.Count = 1;  // CS0229  
        // Try one of the following lines instead:  
        // ((IList)x).Count = 1;  
        // or  
        // ((Icounter)x).Count = 1;  
    }  
  
    public static void Main() {}  
}  

Show: