Skip to content

Conversation

@softwarepronto
Copy link
Contributor

Summary

The example includes:
using WebClient client = new WebClient();
using Stream data = client.OpenRead(args[0]);

But was missing:
StreamReader reader = new StreamReader(data);

Fixes #Issue_Number (if available)

The example includes:
using WebClient client = new WebClient();
using Stream data = client.OpenRead(args[0]);

But was missing:
StreamReader reader = new StreamReader(data);
@softwarepronto softwarepronto requested a review from a team as a code owner October 22, 2022 12:11
@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-System.Net labels Oct 22, 2022
@ghost
Copy link

ghost commented Oct 22, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Summary

The example includes:
using WebClient client = new WebClient();
using Stream data = client.OpenRead(args[0]);

But was missing:
StreamReader reader = new StreamReader(data);

Fixes #Issue_Number (if available)

Author: softwarepronto
Assignees: -
Labels:

area-System.Net, community-contribution

Milestone: -

@opbld31
Copy link

opbld31 commented Oct 22, 2022

Learn Build status updates of commit 1453f9b:

✅ Validation status: passed

File Status Preview URL Details
snippets/csharp/System.Net/WebClient/Overview/useragent.cs ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@softwarepronto
Copy link
Contributor Author

softwarepronto commented Oct 23, 2022 via email

@antonfirsov
Copy link
Contributor

antonfirsov commented Oct 23, 2022

I think it would be still better to delete the explicit Close() calls. Since they are functionally equivalent to Dispose() for these types, they are redundant. Leaving the calls could result in confusion, and false conclusions: "Why is the official sample also closing? So it means Dispose() and Close() are not equivalent here?"

Per @anton's comments, removed Close methods as the using performs the close.
@opbld31
Copy link

opbld31 commented Oct 24, 2022

Learn Build status updates of commit 664d8a1:

✅ Validation status: passed

File Status Preview URL Details
snippets/csharp/System.Net/WebClient/Overview/useragent.cs ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this change @softwarepronto

I like where this landed. I'll :shipit: now.

@BillWagner BillWagner merged commit c1e7e4f into dotnet:main Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants