NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0546

'accessor' : cannot override because 'property' does not have an overridable set accessor

An attempt to override one of the accessor methods for a property failed because the accessor cannot be overridden. To resolve, add the virtual keyword in front of the accessor you want to override. Or, you can make the class that holds the property abstract, in which case the accessor methods would have no implementation.

The following sample generates CS0546:

namespace x
{
   public class a 
   {
      public int i
      {
         get
         {
            return 0;
         }
         // uncomment the following accessor to resolve this CS0546
         /*
         virtual set
         {
         }
         */
      }
   }

   public class b : a 
   {
      public override int i
      {
         set   // CS0546, no set
         {
         }
      }
      public static void Main()
      {
      }
   }
}

See Also

Property Declaration | Accessors