This documentation is archived and is not being maintained.

Compiler Error CS0548 

Error Message

'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 Using Properties (C# Programming Guide).

Example

The following sample generates CS0548.

// CS0548.cs
// compile with: /target:library
public class b
{
   public int MyProp {}   // CS0548

   public int MyProp2   // OK
   {
      get
      {
         return 0;
      }
      set {}
   }
}
Show: