-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Updated description of how to define ref return value #6377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BillWagner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great set of changes @pkulikov
I had two small comments, and then it's ready to merge.
| ```csharp | ||
| public ref Person GetContactInformation(string fname, string lname); | ||
| ``` | ||
| - the method signature includes the [ref](../../language-reference/keywords/ref.md) keyword in front of the return type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be better shown as an unordered list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it already unordered @BillWagner? Or it should be numbered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. 👀 weren't seeing the '-' earlier.
Then, just two very small nits: Each should be a sentence, so period after "return type" in the first, instead of a comma, and capitalize "The" and "Each".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated! Thank you for review.
| - each [return](../../language-reference/keywords/return.md) statement in the method body includes the [ref](../../language-reference/keywords/ref.md) keyword in front of the name of the returned instance. | ||
|
|
||
| In addition, the name of the object returned by each [return](../../language-reference/keywords/return.md) statement in the method body must be preceded by the [ref](../../language-reference/keywords/ref.md) keyword. For example, the following `return` statement returns a reference to a `Person` object named `p`: | ||
| The following example shows the method that satisfies those conditions and returns a reference to a `Person` object named `p`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change "the method" to "a method"
Separated description of conditions and the example.
Fixes #6369