Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1043

{ or ; expected

A property accessor was declared incorrectly.

The following sample generates CS1043:

// CS1043.cs
public class MyClass
{
   public int DoSomething
   {
      get return 1;   // CS1043
      // try the following line instead
      // get { return 1;}
   }

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