-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Use top level statements and update screenshots #51568
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
Open
meaghanlewis
wants to merge
3
commits into
dotnet:main
Choose a base branch
from
meaghanlewis:use-top-level-statements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Binary file modified
BIN
-16.2 KB
(78%)
docs/core/tutorials/media/debugging-with-visual-studio/breakpoint-hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-11.3 KB
(81%)
docs/core/tutorials/media/debugging-with-visual-studio/breakpoint-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-6.17 KB
(75%)
docs/core/tutorials/media/debugging-with-visual-studio/immediate-window-output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-19 KB
(76%)
docs/core/tutorials/media/debugging-with-visual-studio/locals-immediate-window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-45.4 KB
.../core/tutorials/media/debugging-with-visual-studio/set-breakpoint-in-editor.png
Binary file not shown.
Binary file added
BIN
+31.7 KB
docs/core/tutorials/media/debugging-with-visual-studio/set-breakpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.79 KB
(120%)
docs/core/tutorials/media/debugging-with-visual-studio/step-into-method.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-44 KB
docs/core/tutorials/media/debugging-with-visual-studio/step-into-source-method.png
Binary file not shown.
Binary file added
BIN
+6.62 KB
docs/core/tutorials/media/debugging-with-visual-studio/use-debug-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.62 KB
...core/tutorials/media/debugging-with-visual-studio/use-release-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-8.75 KB
...re/tutorials/media/debugging-with-visual-studio/visual-studio-toolbar-debug.png
Binary file not shown.
Binary file removed
BIN
-8.48 KB
.../tutorials/media/debugging-with-visual-studio/visual-studio-toolbar-release.png
Binary file not shown.
Binary file modified
BIN
-315 Bytes
(99%)
docs/core/tutorials/media/publishing-with-visual-studio/pick-publish-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-340 Bytes
(98%)
.../tutorials/media/publishing-with-visual-studio/pick-specific-publish-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-180 Bytes
(99%)
docs/core/tutorials/media/publishing-with-visual-studio/publish-context-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-468 Bytes
(98%)
docs/core/tutorials/media/publishing-with-visual-studio/publish-page-loc-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.91 KB
(110%)
docs/core/tutorials/media/publishing-with-visual-studio/publish-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.15 KB
(110%)
docs/core/tutorials/media/publishing-with-visual-studio/published-files-output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14 KB
docs/core/tutorials/media/publishing-with-visual-studio/show-all-files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.62 KB
...ore/tutorials/media/publishing-with-visual-studio/use-release-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-7.13 KB
...tutorials/media/publishing-with-visual-studio/visual-studio-toolbar-release.png
Binary file not shown.
Binary file added
BIN
+37.1 KB
docs/core/tutorials/media/with-visual-studio/additional-information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-40.9 KB
(47%)
docs/core/tutorials/media/with-visual-studio/configure-new-project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-54.1 KB
(55%)
docs/core/tutorials/media/with-visual-studio/create-new-project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-40.6 KB
(46%)
docs/core/tutorials/media/with-visual-studio/start-window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,22 +39,16 @@ Create a .NET console app project named "HelloWorld". | |
| :::image type="content" source="./media/with-visual-studio/configure-new-project.png" alt-text="Configure your new project window with Project name, location, and solution name fields"::: | ||
|
|
||
| 1. In the **Additional information** dialog: | ||
| - Select **.NET 10**. | ||
| - Select **Do not use top-level statements**. | ||
| - Select **.NET 10.0 (Long Term Support)**. | ||
| - Select **Create**. | ||
|
|
||
| :::image type="content" source="./media/with-visual-studio/additional-information.png" alt-text="Enter additional information for the console app."::: | ||
|
|
||
| The template creates a simple application that displays "Hello, World!" in the console window. The code is in the *Program.cs* or *Program.vb* file: | ||
|
|
||
| ```csharp | ||
| namespace HelloWorld; | ||
|
|
||
| internal class Program | ||
| { | ||
| static void Main(string[] args) | ||
| { | ||
| Console.WriteLine("Hello, World!"); | ||
| } | ||
| } | ||
| // See https://aka.ms/new-console-template for more information | ||
| Console.WriteLine("Hello, World!"); | ||
| ``` | ||
|
|
||
| ```vb | ||
|
|
@@ -69,9 +63,7 @@ Create a .NET console app project named "HelloWorld". | |
|
|
||
| If the language you want to use is not shown, change the language selector at the top of the page. | ||
|
|
||
| The code defines a class, `Program`, with a single method, `Main`, that takes a <xref:System.String> array as an argument. `Main` is the application entry point, the method that's called automatically by the runtime when it launches the application. Any command-line arguments supplied when the application is launched are available in the *args* array. | ||
|
|
||
| C# has a feature named [top-level statements](../../csharp/fundamentals/program-structure/top-level-statements.md) that lets you omit the `Program` class and the `Main` method. This tutorial doesn't use this feature. Whether you use it in your programs is a matter of style preference. | ||
| The code defines a class, `Program`, that calls the <xref:System.Console.WriteLine(System.String)?displayProperty=nameWithType> method to display a message in the console window. | ||
meaghanlewis marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kind of agree with CCR here. You can't call a method directly from a class, and I don't see where you're defining the class. |
||
|
|
||
| ## Run the app | ||
|
|
||
|
|
@@ -85,12 +77,12 @@ Create a .NET console app project named "HelloWorld". | |
|
|
||
| Enhance the application to prompt the user for their name and display it along with the date and time. | ||
|
|
||
| 1. In *Program.cs* or *Program.vb*, replace the contents of the `Main` method, which is the line that calls `Console.WriteLine`, with the following code: | ||
| 1. In *Program.cs* or *Program.vb*, replace the contents with the following code: | ||
|
|
||
| :::code language="csharp" source="./snippets/with-visual-studio/csharp/Program.cs" id="MainMethod"::: | ||
| :::code language="vb" source="./snippets/with-visual-studio/vb/Program.vb" id="MainMethod"::: | ||
|
|
||
| This code displays a prompt in the console window and waits until the user enters a string followed by the <kbd>Enter</kbd> key. It stores this string in a variable named `name`. It also retrieves the value of the <xref:System.DateTime.Now?displayProperty=nameWithType> property, which contains the current local time, and assigns it to a variable named `currentDate`. And it displays these values in the console window. Finally, it displays a prompt in the console window and calls the <xref:System.Console.ReadKey(System.Boolean)?displayProperty=nameWithType> method to wait for user input. | ||
| This code displays a prompt in the console window and waits until the user enters a string followed by the <kbd>Enter</kbd> key. It stores this string in a variable named `name`. It also retrieves the value of the <xref:System.DateTime.Now?displayProperty=nameWithType> property, which contains the current local time, and assigns it to a variable named `currentDate`. And it displays these values in the console window. Finally, it displays a prompt in the console window and calls the <xref:System.Console.Read> method to wait for user input. | ||
meaghanlewis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <xref:System.Environment.NewLine?displayProperty=nameWithType> is a platform-independent and language-independent way to represent a line break. Alternatives are `\n` in C# and `vbCrLf` in Visual Basic. | ||
|
|
||
|
|
||
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.
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.
From https://learn.microsoft.com/en-us/style-guide/procedures-instructions/formatting-text-in-instructions:
"If an option label ends with a colon or an ellipsis, don't include that end punctuation in instructions."