Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0229

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.

The following sample generates CS0229:

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

interface Icounter
{
   void Count(int i);
}

interface IListCounter : IList , Icounter
{
}

class main
{
   void Test(IListCounter x)
   {
      x.Count = 1;  // CS0229
      x.Count(1);   // CS0229
      // try the following lines instead
      // ((IList)x).Count = 1;
      // ((ICounter)x).Count(1);
   }

   public static void Main()
   {
   }
}
Show:
© 2014 Microsoft