Compiler Error CS0229

“member1”和“member2”之间具有二义性

不同接口的成员具有相同的名称。如果要保留相同的名称,则必须限定这些名称。有关更多信息,请参见接口(C# 编程指南)

注意
在某些情况下,此二义性可以通过使用 using 别名向标识符提供明确的前缀来解决。

下面的示例生成 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() {}
}