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.
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()
{
}
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: