-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Added comment about virtual methods #3105
Conversation
Added a line about not overriding virtual methods because of issues involved with it.
This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request. |
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.
LGTM
xml/System.Net.Http/HttpClient.xml
Outdated
@@ -25,7 +25,7 @@ | |||
## Remarks | |||
The <xref:System.Net.Http.HttpClient> class instance acts as a session to send HTTP requests. An <xref:System.Net.Http.HttpClient> instance is a collection of settings applied to all requests executed by that instance. In addition, every <xref:System.Net.Http.HttpClient> instance uses its own connection pool, isolating its requests from requests executed by other <xref:System.Net.Http.HttpClient> instances. | |||
|
|||
The <xref:System.Net.Http.HttpClient> also acts as a base class for more specific HTTP clients. An example would be a FacebookHttpClient providing additional methods specific to a Facebook web service (a GetFriends method, for instance). | |||
The <xref:System.Net.Http.HttpClient> also acts as a base class for more specific HTTP clients. An example would be a FacebookHttpClient providing additional methods specific to a Facebook web service (a GetFriends method, for instance). Derived classes should not override the virtual methods on the class. Use the constructor overload accepting <xref:System.Net.Http.HttpMessageHandler> to configure any pre- or post-request processing instead. |
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.
LGTM. Wondering if it would be better to say "Use a constructor overload that accepts" since there's more than one though.
/cc @stevewhims
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.
The "instead" works well to flow the thought from one sentence to the next, but I'd put the "instead" at the start of the 2nd sentence. Then the reader doesn't need to wait till the end of the sentence to parse that connection. So: "Instead, use a constructor overload that accepts ...".
Thanks @CoolDadTx for adding this. I've made some minor changes based on the feedback given, so we can merge this PR. I'll wait for the CI build to finish before merging. The fix should go live in our next wave of updates to production in the next day or so. |
* Typo in document - IOne instead of One (#3202) Typo in document - IOne instead of One * Fix framework in dotnet store command topic (#3188) Reported by @pauliusnorkus. Thanks to @dasMulli for reminding me about the framework problem here. Using `netstandard2.0` worked during pre-release but no more. * Modified BindingOperations.EnableCollectionSynchronization overloads (#3153) * Modified BindingOperations.EnableCollectionSynchronization overloads * Some corrections to last overload * Incorporated review comments * Addressed review comments * Fixed bad xrefs * 90785 WebClient.Credentials property is cleared on redirect (#3087) * 90785 WebClient.Credentials property is cleared on redirect * Removing "or UseDefaultCredentials"; it's also cleared during redirects. * apply feedback * Added comment about virtual methods (#3105) * Added comment about virtual methods Added a line about not overriding virtual methods because of issues involved with it. * applying feedback * Fixed: Invalid example code (#3204) * Fixed wrong example code A large chunk of the the example code in 'Listening by Registering a Callback' section had nothing to do with registering a callback. I added a small but complete example of using the CancellationToken.Register method. * Fixed wrong example code A large chunk of the the example code in 'Listening by Registering a Callback' section had nothing to do with registering a callback. I added a small but complete example of using the CancellationToken.Register method. (I submitted an equivalent change proposal for the C# example). * Problem of round-tripping Double values (#3101) * Problem of round-tripping Double values * Addressed review comments, revised Single documentation * Incorporated reviewer comments
Title
Added comment on virtual methods
Summary
Added comment about using HttpMessageHandler instead of overriding virtual methods when extending the class.
Suggested Reviewers
@davidsh @karelz