Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0548

'property' : property or indexer must have at least one accessor

A property must have at least one accessor (get or set) method.

For more information, see Property Declaration and Accessors.

The following sample generates CS0548:

// CS0548.cs
public class b
{
   public int MyProp   // CS0548
   {
      // remove comments to resolve CS0548
      /*
      get
      {
         return 0;
      }
      set
      {
         return 0;
      }
      */
   }

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