Edit

Share via


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 and Using Properties.

Example

The following sample generates CS0548.

C#
// CS0548.cs  
// compile with: /target:library  
public class b  
{  
   public int MyProp {}   // CS0548  
  
   public int MyProp2   // OK  
   {  
      get  
      {  
         return 0;  
      }  
      set {}  
   }  
}