Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Cannot return 'this' by reference.
A ref
argument must be an assignable variable or array element. this
is not assignable and cannot be returned by reference.
Example
The following sample generates CS8354:
// CS8354.cs (6,20)
class Program
{
ref Program M()
{
return ref this;
}
}
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.