Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1014

A get or set accessor expected

A method declaration was found in a property declaration. You can only declare get and set methods in a property.

For more information on properties, see Using Properties (C# Programming Guide).

The following sample generates CS1014.

// CS1014.cs
// compile with: /target:library
class Sample
   public int TestProperty
         return 0;
      int z;   // CS1014  not get or set

Community Additions

© 2015 Microsoft