-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Remove empty sections #6126
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
Remove empty sections #6126
Conversation
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 left a couple of comments, @mairaw, about removing 2 using statements and the sections on compiling the code. You can then merge when you're ready.
| } | ||
| ``` | ||
|
|
||
| ## Compiling the code |
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 section can also be deleted, References are to assemblies, not namespaces; importing the System,.Net namespace is handled by the using statement. No types in the System.Net assembly are used.
| } | ||
| ``` | ||
|
|
||
| ## Compiling the code |
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.
Same comment as previously: this section can be deleted.
| } | ||
| ``` | ||
|
|
||
| ## Compiling the code |
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 section can be removed.
| using System; | ||
| using System.IO; | ||
| using System.Net; | ||
| using System.Text; |
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 using System.Text; statement is not needed and can be deleted.
| using System; | ||
| using System.IO; | ||
| using System.Net; | ||
| using System.Text; |
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 using System.Text; statement is not needed and can be deleted.
|
@rpetrusha thanks for your thorough review. I wasn't much looking at the content inside the sections. Since we were improving the topics, I also added the VB version of those. Do you wanna double check? |
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.
Left a number of additional suggestions, @mairaw. Other than removing Imports System, which I'd recommend strongly, you can decide whether you want to do them or not.
| ``` | ||
|
|
||
| ```vb | ||
| Imports System |
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.
Imports System isn't necessary; it's automatically imported by the compiler.
| Imports System.Net | ||
|
|
||
| Namespace Examples.System.Net | ||
| Public Class WebRequestGetExample |
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.
It's typical to do this as a module (Public Module WebRequestGetExample)
|
|
||
| Namespace Examples.System.Net | ||
| Public Class WebRequestGetExample | ||
| Public Shared Sub Main() |
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.
If this becomes a module, the signature becomes Public Sub Main()
| reader.Close() | ||
| response.Close() | ||
| End Sub | ||
| End Class |
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 becomes End Module
| } | ||
| ``` | ||
|
|
||
| ```vb |
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.
Same comments as previously: System does not need to be imported, and a Module is better Irequiring a change to the Main method signature as well).
| ``` | ||
|
|
||
| ```vb | ||
| Imports System |
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.
Same comments here as for previous examples.
| StreamReader reader = new StreamReader(responseStream); | ||
| Console.WriteLine(reader.ReadToEnd()); | ||
|
|
||
| Console.WriteLine("Download Complete, status {0}", response.StatusDescription); |
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.
These Console.WriteLine statements with composite formatting strings could be done as interpolated strings in C# and VB if you'd like to make the changes. Here, `Console.WriteLine($"Download Complete, status {response.StatusDescription}");
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.
are we adding notes about C# version needed when adding interpolated strings?
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.
Sorry, @mairaw. I missed your question. No, we haven't been, other than in the C# and VB interpolated string docs themselves.
|
Appreciate your comments @rpetrusha. I believe all the feedback is now addressed. |
Fixes #6118 - found a few more topics with the same issue
Hide whitespace changes for a better diff