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 comments to guide completion - Visual Studio Tutorial
From the course: AI-Powered Development: GitHub Copilot in Visual Studio
Use comments to guide completion
- [Instructor] Let's explore how Copilot can generate structured code from a simple comment. I'll describe the task in simple English within a comment, and Copilot will scaffold the logic for working with an XML file. This shows how natural language can drive code generation. Before I get started, let's talk about the code that's already in this method. I have a method called GetXMLContent that's in this class, and it's going to open this WebColors.xml file. That file is here, it's in my data folder. It has a Colors root element, and then it has a number of Color elements. And what I wanna retrieve from this file is the color-name, which is in an attribute, and I wanna retrieve the Hex value, which is in an element. So, what I'm doing here is I've written this comment, Load color data from an XML file and extract relevant elements. This is the code that will work, but it's already here, but let me show you how I can…