From the course: AI-Powered Development: GitHub Copilot in Visual Studio

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Use custom instructions effectively

Use custom instructions effectively

- [Instructor] To highlight the power of custom instructions, let's walk through a simple example. We'll generate a utility class both before and after providing Copilot with naming convention guidance. So what I wanted to start with is asking it to generate this math utils class. So I'll paste this in here. I want it to create a math utils class with a method to calculate the sum of two integers. And I get back something in a namespace. It's in a utilities namespace. It's a public class called Math Utils, it has some xml comments here, some documents, and it has a method called Sum that has two parameters. So, so far it looks good, but I have some naming convention I'd like to use. So let's go add those to this markdown file. Now it doesn't matter where you put it, it's a text file. And remember, this all gets sent with every prompt. I like to put it in these header sections so I know where to find it when I'm looking for…

Contents