Nice work! You just used AI code suggestions within a C# file by using GitHub Copilot ✨
Keep in mind that as you continue to use copilot, you may not want some of the suggestions GitHub Copilot offers. GitHub Copilot will show you multiple suggestions in a new tab.
- From inside the codespace in the Solution Explorer, right click on the project, create a new file.
Note: If you closed the Codespace from above please open it back up or create a new Codespace.
-
Select Class and name the file
Members.cs
-
In the
Members.cs
file, type the following function inside of theMember
class.public strin
-
Stop typing and view the Copilot suggestion by hovering over end the red squiggly grat text and select the
...
-
Click
Open Completions Panel
.Note If you don't see the copilot code block suggestion or the red squiggly and the three dots
...
, you can typecontrol + enter
to bring up the GitHub Copilot completions panel. -
Copilot will synthesize around 10 different code suggestions or press CTRL+Enter. You should see something like this:
-
Find a solution you like and click
Accept Solution
. -
Your
Member.cs
file will be updated with your solution.
Let's use GitHub Copilot to summarize our changes and then commit the code.
- Open the Source Control tab
- Tap on the ✨ button in the Message entry for Copilot to generate your message.
- Click the Commit button.
Head to Part 4 of the Exercise