Skip to content

Commit 4e381d5

Browse files
authored
Merge pull request #2498 from gewarren/new-user
Strategic updates to getting started content
2 parents d4ddbcc + 257683a commit 4e381d5

32 files changed

+172
-137
lines changed
7.15 KB
Loading
28.8 KB
Loading
27.3 KB
Loading
Loading

docs/ide/media/editor-dark.png

20.8 KB
Loading

docs/ide/media/editor.png

15.5 KB
Loading
21.7 KB
Loading

docs/ide/media/file-new-project.png

17 KB
Loading
8.87 KB
Loading
Loading

docs/ide/media/peek-definition.png

9.15 KB
Loading

docs/ide/media/quick-launch-nuget.png

14.2 KB
Loading
3.33 KB
Loading

docs/ide/media/quickstart-editor.png

9.52 KB
Loading
Loading
Loading
1.92 KB
Loading
Loading
24.7 KB
Loading
Loading
Loading

docs/ide/media/refactoring-menu.png

16.2 KB
Loading

docs/ide/media/squiggles-error.png

4.4 KB
Loading
Loading
8.38 KB
Loading

docs/ide/media/start-page.png

95.9 KB
Loading

docs/ide/quickstart-editor.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,47 @@ ms.workload:
1414
---
1515
# Quickstart: Use the code editor
1616

17-
In this 10-minute introduction to the editor, we'll add code to a file to look at some of the ways that Visual Studio makes writing, navigating, and understanding code easier.
17+
In this 10-minute introduction to the code editor in Visual Studio, we'll add code to a file to look at some of the ways that Visual Studio makes writing, navigating, and understanding code easier.
1818

1919
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://visualstudio.microsoft.com/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=button+cta&utm_content=download+vs2017) page to install it for free.
2020

21-
This quickstart assumes you are already familiar with a programming language. If you aren't, we suggest you look at one of the programming quickstarts first, such as create a web app with [Python](../ide/quickstart-python.md) or [C#](../ide/tutorial-csharp-aspnet-core.md), or create a console app with [Visual Basic](../ide/quickstart-visual-basic-console.md) or [C++](../ide/getting-started-with-cpp-in-visual-studio.md).
21+
This quickstart assumes you're already familiar with a programming language. If you aren't, we suggest you look at one of the programming quickstarts first, such as create a web app with [Python](../ide/quickstart-python.md) or [C#](../ide/tutorial-csharp-aspnet-core.md), or create a console app with [Visual Basic](../ide/quickstart-visual-basic-console.md) or [C++](../ide/getting-started-with-cpp-in-visual-studio.md).
2222

2323
## Create a new code file
2424

25-
Start by creating a new file and adding some code to it. Notice that we do not have to create a project to gain some of the benefits that the editor offers.
25+
Start by creating a new file and adding some code to it.
2626

2727
1. Open Visual Studio, and from the **File** menu on the menu bar, choose **New** > **File**.
2828

2929
1. In the **New File** dialog box, under the **General** category, choose **Visual C# Class**, and then choose **Open**.
3030

31-
A new file opens in the editor with the skeleton of a C# class.
31+
A new file opens in the editor with the skeleton of a C# class. (Notice that we don't have to create a full Visual Studio project to gain some of the benefits that the code editor offers; all you need is a code file!)
32+
33+
![C# code file in Visual Studio](media/quickstart-editor.png)
3234

3335
## Use code snippets
3436

35-
Visual Studio provides useful code snippets that you can use to quickly and easily generate commonly used code blocks. [Code snippets](../ide/code-snippets.md) are available for different programming languages including C#, Visual Basic, and C++. Let's add the C# `void Main` snippet to our file.
37+
Visual Studio provides useful *code snippets* that you can use to quickly and easily generate commonly used code blocks. [Code snippets](../ide/code-snippets.md) are available for different programming languages including C#, Visual Basic, and C++. Let's add the C# `void Main` snippet to our file.
3638

37-
1. Place your cursor below the closing brace of the `Class1` constructor and enter the characters `svm`.
39+
1. Place your cursor just above the final closing brace **}** in the file, and type the characters `svm` (which stands for `static void Main`—don't worry too much if you don't know what that means).
3840

39-
You see an **IntelliSense** dialog box appear with information about the `svm` snippet.
41+
A pop-up dialog box appears with information about the `svm` code snippet.
4042

41-
![IntelliSense snippet](media/quickstart-intellisense-snippet.png)
43+
![IntelliSense for code snippet in Visual Studio](media/quickstart-intellisense-snippet.png)
4244

4345
1. Press **Tab** twice to insert the code snippet.
4446

45-
You see the `static void Main()` method signature get added to the file. The `Main()` method is the entry point for C# applications.
47+
You see the `static void Main()` method signature get added to the file. The [Main()](/dotnet/csharp/programming-guide/main-and-command-args/) method is the entry point for C# applications.
4648

47-
The available code snippets vary for different languages. You can look at the available code snippets for your programming language by choosing **Edit** > **IntelliSense** > **Insert Snippet**, and then choosing your language's folder. For C#, the list looks like this:
49+
The available code snippets vary for different programming languages. You can look at the available code snippets for your language by choosing **Edit** > **IntelliSense** > **Insert Snippet**, and then choosing your language's folder. For C#, the list looks like this:
4850

4951
![C# code snippet list](media/quickstart-code-snippet-list.png)
5052

51-
The list includes snippets for creating a class, a constructor, `Console.WriteLine()`, `for` loops, `if` and `switch` statements, and more.
53+
The list includes snippets for creating a [class](/dotnet/csharp/programming-guide/classes-and-structs/classes), a [constructor](/dotnet/csharp/programming-guide/classes-and-structs/constructors), a [for](/dotnet/csharp/language-reference/keywords/for) loop, an [if](/dotnet/csharp/language-reference/keywords/if-else) or [switch](/dotnet/csharp/language-reference/keywords/switch) statement, and more.
5254

5355
## Comment out code
5456

55-
The toolbar provides a number of buttons to make you more productive as you code. For example, you can toggle IntelliSense completion mode, increase or decrease an indent, set a bookmark, or comment out code. In this section, we'll comment out some code that we don't want to compile.
57+
The toolbar, which is the row of buttons under the menu bar in Visual Studio, can help make you more productive as you code. For example, you can toggle IntelliSense completion mode ([IntelliSense](using-intellisense.md) is a coding aid that displays a list of matching methods, amongst other things), increase or decrease a line indent, or comment out code that you don't want to compile. In this section, we'll comment out some code.
5658

5759
![Editor toolbar](media/quickstart-editor-toolbar.png)
5860

@@ -80,25 +82,25 @@ The toolbar provides a number of buttons to make you more productive as you code
8082
select word;
8183
```
8284

83-
1. We are not using the `morewords` variable, but we may use it later so we don't want to delete it. Instead, let's comment out those lines. Select the entire definition of `morewords` to the closing semi-colon, and then choose the **Comment out the selected lines** button on the toolbar, or press **Ctrl**+**K**, **Ctrl**+**C**.
85+
1. We're not using the `morewords` variable, but we may use it later so we don't want to completely delete it. Instead, let's comment out those lines. Select the entire definition of `morewords` to the closing semi-colon, and then choose the **Comment out the selected lines** button on the toolbar. If you prefer to use the keyboard, press **Ctrl**+**K**, **Ctrl**+**C**.
8486

8587
![Comment out button](media/quickstart-comment-out.png)
8688

8789
The C# comment characters `//` are added to the beginning of each selected line to comment out the code.
8890
8991
## Collapse code blocks
9092

91-
We don't want to see the empty constructor for `Class1` that was generated, so to unclutter our view of the code, let's collapse it. Choose the small gray box with the minus sign inside it in the margin of the first line of the constructor. Or, if you are a keyboard user, place the cursor anywhere in the constructor code and press **Ctrl**+**M**, **Ctrl**+**M**.
93+
We don't want to see the empty [constructor](/dotnet/csharp/programming-guide/classes-and-structs/constructors) for `Class1` that was generated, so to unclutter our view of the code, let's collapse it. Choose the small gray box with the minus sign inside it in the margin of the first line of the constructor. Or, if you're a keyboard user, place the cursor anywhere in the constructor code and press **Ctrl**+**M**, **Ctrl**+**M**.
9294

9395
![Outlining collapse button](media/quickstart-collapse.png)
9496

9597
The code block collapses to just the first line, followed by an ellipsis (`...`). To expand the code block again, click the same gray box that now has a plus sign in it, or press **Ctrl**+**M**, **Ctrl**+**M** again. This feature is called [Outlining](../ide/outlining.md) and is especially useful when you're collapsing long methods or entire classes.
9698

9799
## View symbol definitions
98100

99-
The Visual Studio editor makes it easy to inspect the definition of a type, method, etc. One way is to navigate to the file that contains the definition, for example by choosing **Go to Definition** anywhere the symbol is referenced. An even quicker way that doesn't move your focus away from the file you're working in is to use [Peek Definition](../ide/go-to-and-peek-definition.md#peek-definition). Let's peek at the definition of `string`.
101+
The Visual Studio editor makes it easy to inspect the definition of a type, method, etc. One way is to navigate to the file that contains the definition, for example by choosing **Go to Definition** anywhere the symbol is referenced. An even quicker way that doesn't move your focus away from the file you're working in is to use [Peek Definition](../ide/go-to-and-peek-definition.md#peek-definition). Let's peek at the definition of the `string` type.
100102

101-
1. Right-click on any occurrence of `string` and choose **Peek Definition** from the content menu—or, press **Alt**+**F12**.
103+
1. Right-click on any occurrence of `string` and choose **Peek Definition** from the content menu. Or, press **Alt**+**F12**.
102104

103105
A pop-up window appears with the definition of the `String` class. You can scroll within the pop-up window, or even peek at the definition of another type from the peeked code.
104106

@@ -108,7 +110,7 @@ The Visual Studio editor makes it easy to inspect the definition of a type, meth
108110

109111
## Use IntelliSense to complete words
110112

111-
[IntelliSense](../ide/using-intellisense.md) is an invaluable resource when you're coding. It can show you information about available members of a type, or parameter details for different overloads of a method. You can also use IntelliSense to complete a word after you type enough characters to disambiguate it. Let's add a line of code to print out the ordered strings to the console window.
113+
[IntelliSense](../ide/using-intellisense.md) is an invaluable resource when you're coding. It can show you information about available members of a type, or parameter details for different overloads of a method. You can also use IntelliSense to complete a word after you type enough characters to disambiguate it. Let's add a line of code to print out the ordered strings to the console window, which is the standard place for output from the program to go.
112114

113115
1. Below the `query` variable, start typing the following code:
114116

@@ -118,9 +120,9 @@ The Visual Studio editor makes it easy to inspect the definition of a type, meth
118120

119121
You see IntelliSense show you **Quick Info** about the `query` symbol.
120122

121-
![IntelliSense word complete](media/quickstart-intellisense-completion-list.png)
123+
![IntelliSense word completion in Visual Studio](media/quickstart-intellisense-completion-list.png)
122124

123-
1. To insert the rest of the word `query` by using IntelliSense's "Complete Word" functionality, press **Tab**.
125+
1. To insert the rest of the word `query` by using IntelliSense's word completion functionality, press **Tab**.
124126

125127
1. Finish off the code block to look like the following code. You can even practice using code snippets again by entering `cw` and then pressing **Tab** twice to generate the `Console.WriteLine` code.
126128

@@ -133,13 +135,13 @@ The Visual Studio editor makes it easy to inspect the definition of a type, meth
133135

134136
## Refactor a name
135137

136-
Nobody gets code right the first time, and one of the things you might want to change is the name of a variable or method. Let's try out Visual Studio's [refactor](../ide/refactoring-in-visual-studio.md) functionality to rename the `_words` variable to `words`.
138+
Nobody gets code right the first time, and one of the things you might have to change is the name of a variable or method. Let's try out Visual Studio's [refactor](../ide/refactoring-in-visual-studio.md) functionality to rename the `_words` variable to `words`.
137139

138-
1. Place your cursor over the definition of the `words` variable, and choose **Rename** from the right-click or context menu, or press **Ctrl**+**R**, **Ctrl**+**R**.
140+
1. Place your cursor over the definition of the `_words` variable, and choose **Rename** from the right-click or context menu, or press **Ctrl**+**R**, **Ctrl**+**R**.
139141

140142
A pop-up **Rename** dialog box appears at the top right of the editor.
141143

142-
1. Enter the desired name `words`. Notice that the reference to `words` in the query is also automatically renamed. Before you press **Enter**, select the **Include comments** checkbox in the **Rename** pop-up box.
144+
1. Enter the desired name **words**. Notice that the reference to `words` in the query is also automatically renamed. Before you press **Enter**, select the **Include comments** checkbox in the **Rename** pop-up box.
143145

144146
![Rename dialog box](media/quickstart-rename.png)
145147

@@ -149,12 +151,12 @@ Nobody gets code right the first time, and one of the things you might want to c
149151

150152
## Next steps
151153

152-
You've completed this Quickstart for the Visual Studio editor! Next you might try out some of the other Quickstarts for the Visual Studio IDE, look at more ways to [Navigate code](../ide/navigating-code.md), or check out the links to more information about the features we looked at. Otherwise, happy coding!
154+
You've completed this Quickstart for the Visual Studio editor. Next, you might try out some of the other Quickstarts for the Visual Studio development environment such as [Quickstart: Projects and solutions](../ide/quickstart-projects-solutions.md) or [Quickstart: Personalize Visual Studio](../ide/quickstart-personalize-the-ide.md), look at more ways to [Navigate code](../ide/navigating-code.md), or check out the links to more information about the features we looked at. Otherwise, happy coding!
153155

154156
## See also
155157

156158
- [Quickstart: First look at the Visual Studio IDE](../ide/quickstart-ide-orientation.md)
157-
- [Quickstart: Personalize the Visual Studio IDE and editor](../ide/quickstart-personalize-the-ide.md)
159+
- [Quickstart: Personalize Visual Studio](../ide/quickstart-personalize-the-ide.md)
158160
- [Quickstart: Projects and solutions](../ide/quickstart-projects-solutions.md)
159161
- [Code snippets](../ide/code-snippets.md)
160162
- [Outlining](../ide/outlining.md)

0 commit comments

Comments
 (0)