Repository navigation
Revised out parameter modifier for C# 7 - #1605
Merged
Merged
Conversation
BillWagner
approved these changes
Mar 6, 2017
BillWagner
left a comment
Member
There was a problem hiding this comment.
@rpetrusha I like the changes and the reorganization.
I left a couple suggestions for possible changes. I'm fine merging this either way. ![]()
|
|
||
| ## Example | ||
|
|
||
| ## Declaring an `out` method |
Member
There was a problem hiding this comment.
It's not really an out method. It's a method with out arguments. Maybe
Declaring out arguments
is a better heading?
|
|
||
| [!code-cs[csrefKeywordsMethodParams#4](../../../../samples/snippets/csharp/language-reference/keywords/out/out-4.cs)] | ||
|
|
||
| A common pattern involves returning a `bool` to indicate whether an operation succeeded and failed, and returning the value produced by the operation in an `out` argument. A number of parsing methods, such as the @System.DateTime.TryParse(System.String,@System.DateTime) method, use this pattern. |
Member
There was a problem hiding this comment.
We're trying to standardize on calling this the "Try* Pattern". It'd be great to use that term here.
Contributor
Author
|
Thanks, @BillWagner. I've incorporated both of your suggestions. I'll merge as soon as the topic builds. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#Revised out parameter modifier for C# 7
Summary
Updated the topic to cover C# 7, and also did some cleanup (described in the Details section).
Fixes #1378
Details
In addition to documenting the declaration of the
outvariable in the method call, I've done the following:codesnippetssubdirectory to a subdirectory ofsamples/snippets.codesnippetssubdirectory.out.md, so that the topic only links to the two contextualoutkeywords. Theout-parameter-modifier.mdtopic completely duplicated theout.mdtopic, which poses a maintenance nightmare and makes it certain that the identical topics (which also had examples in independent code files) will eventually get out of sync.toc.md) so thatout.mdis not in the TOC. It serves to disambiguateout, but does not otherwise appear in the TOC.Suggested Reviewers
@BillWagner