You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Using-GitHub-Copilot-with-CSharp/README.md
+21-9Lines changed: 21 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ By the end of this module, you'll acquire the skills to be able to:
30
30
31
31
1. Enable your [GitHub Copilot service](https://github.com/github-copilot/signup)
32
32
33
-
1.Get familiar with[this repository with Codespaces](https://github.com/github/dotnet-codespaces)
33
+
1.Open[this repository with Codespaces](https://github.com/github/dotnet-codespaces)
34
34
35
35
## 💪🏽 Exercise
36
36
@@ -88,6 +88,14 @@ In the above exercises we achieved the following:
88
88
89
89
### 🗒️ Section 2: Code Completion
90
90
91
+
**🎯 Learning Goals**
92
+
93
+
- Use inline code completion to write code from comments.
94
+
- Trigger and refine Copilot completions.
95
+
- Use inline chat and slash commands.
96
+
97
+
In the previous section you learned how to use both natural language or slash commands to quickly understand the codebase without digging through folders. In the next set of exercises we're going to use Copilot to make some changes to the API using code completion.
98
+
91
99
1. Ask GitHub Copilot in the chat pane to "run and debug" the backend project (you can also do this from the 'run and debug' panel in the editor). Start Debugging the selected project.
92
100
93
101
<divalign="left">
@@ -112,7 +120,7 @@ https://< your url>.app.github.dev/weatherforecast
112
120
<imgsrc="./images/005ports.jpg"alt="port view in the editor">
113
121
</div>
114
122
115
-
1. In this next step we want to refactor some code and generate a new record for our Weather API. The goal is to add a new record that includes the name of the city. We are going to achieve this by asking Copilot directly from the file using code comments. From the file pane, navigate to the following path `SampleApp\BackEnd\Program.cs` and open `Program.cs`. Navigate to the end of the file and type in (or copy):
123
+
3. In this next step we want to refactor some code and generate a new record for our Weather API. The goal is to add a new record that includes the name of the city. We are going to achieve this by asking Copilot directly from the file using code comments. From the file pane, navigate to the following path `SampleApp\BackEnd\Program.cs` and open `Program.cs`. Navigate to the end of the file and type in (or copy):
116
124
117
125
```csharp
118
126
// create a new internal record named WeatherForecastByCity that requests the following parameters: City, Date, TemperatureC, Summary
@@ -124,19 +132,19 @@ The output should be similar to this:
124
132
<imgsrc="./images/006internalrecord.jpg"alt="changes to existing record">
125
133
</div>
126
134
127
-
4. Now we want to use the inline feature of Copilot. Using the inline feature we can focus on the code in front of us and make progressive changes as needed in our code base. Next, we will create a new C# class by creating a new file under the `Backend` folder: `SampleApp\BackEnd\Customer.cs`.
135
+
1. Now we want to use the inline feature of Copilot. When using the inline feature we can focus on the code in front of us and make progressive changes as needed in our code base. Next, we will create a new C# class by creating a new file under the `Backend` folder: `SampleApp\BackEnd\Customer.cs`.
From the top of the editor, press `CTRL + I` to open the inline chat and type (or copy) in:
141
+
From the top of the editor, press `CTRL + I` to open inline chat and type (or copy) in:
134
142
135
143
```csharp
136
144
// Create a class for a Customer with Id, Name, and Email, and a method to validate email format
137
145
```
138
146
139
-
5. Accept the suggestion and and with the output, using the inline prompt window ask:
147
+
5. Accept the suggestion and with the output, using the inline prompt window ask:
140
148
141
149
```csharp
142
150
/improveIsValidEmailmethodusingRegex
@@ -171,7 +179,7 @@ In the above exercises we achieved the following:
171
179
172
180
[GitHubCopilotAgentMode](https://github.blog/ai-and-ml/github-copilot/agent-mode-101-all-about-github-copilots-powerful-mode/) is an autonomous AI coding assistant that acts as a synchronous collaborator in real-time. It can perform coding tasks that require multiple steps all while using your natural language prompts. When working in Agent Mode, Copilot can problem solve alongside you, understanding your intent, and when the built solution needs some tweaking, it can iterate until it gets it right. In this section we're going to use Agent Mode to make a multitude of changes to our backend service to provide several improvement to our code.
0 commit comments