Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0146

Circular base class definition between 'class1' and 'class2'

The inheritance list for a class includes a direct or indirect reference to itself. A class cannot inherit from itself.

The following sample generates CS0146:

// CS0146.cs
namespace x
{
   public interface a
   {
   }

   public class b : a, c
   {
      public void Main()
      {
      }
   }

   public class c : b   // CS0146
   {
   }
}
Show:
© 2014 Microsoft