This documentation is archived and is not being maintained.

Compiler Error CS0560

Visual Studio .NET 2003

Accessor 'accessor1' : cannot override 'accessor2' because it is hidden by 'function'

A property definition is hidden in an indirect base class.

For more information, see Property Declaration and Accessors.

The following sample generates CS0560:

// CS0560.cs
namespace NC
{
   class B
   {
      virtual public int Prop
      {
         get
         {
            return 0;
         }
         set
         {
         }
      }
   }

   abstract class D : B
   {
      public new int set_Prop(int i)
      {
         return 0;
      }

      // to resolve this CS0560, delete the set_Prop method and
      // uncomment the definition of Prop
      /*
      public override int Prop
      {
         set
         {
            return;
         }
         get
         {
            return 0;
         }
      }
      */
   }

   class DD : D
   {
      // override blocked by non-accessors
      public override int Prop
      {
         get
         {
            return 0;
         }
         set   // CS0560
         {
            return;
         }
      }

      public static void Main()
      {
      }
   }
}
Show: