Compiler Error CS0127

Since 'function' returns void, a return keyword must not be followed by an object expression

A method with a void return type cannot return a value. For more information, see Methods (C# Programming Guide).

The following sample generates CS0127:

// CS0127.cs
namespace MyNamespace
{
   public class MyClass
   {
      public int hiddenMember2
      {
         get
         {
            return 0;
         }
         set   // CS0127, set has an implicit void return type
         {
            return 0;   // remove return statement to resolve this CS0127
         }
      }

      public static void Main()
      {
      }
   }
}