Intro to C# with GitHub Copilot in Visual Studio 2022

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you're a c sharper.net developer and are looking to get started with GitHub co-pilot for visual studio then this is the video for you I'm Katie Savage a program manager at Microsoft and today I'm going to take you through two quick and simple demos to get you started using copilot let's take a look for this demo we're going to use GitHub copilot to help us write some link query expressions in Visual Studio so in this example I have a simple in-memory database that has some student objects where each student has a first name last name ID and an array of their integer test scores so with the help of copilot I'm going to query this data execute those queries and then modify them remember copilot is just that a co-pilot and you should definitely be checking along the way to make sure it's giving you the results that you want so the first thing I'm going to show you how to do is generate some new data with the help of Copilot so I'm going to go in on line 16. and then I'm going to prompt copilot with a comment and ask it to help me generate this data as you can see it's already kind of anticipating what I want and giving me the following suggestion but this uh student objects then is actually already a student um as you can see on line six so I'm going to go ahead and continue with my prompt so I'm going to utilize a comment and then I'm going to write and write new student as you can see copilot did a good job of creating a new student with a unique name and ID number for me um but I didn't specify that it should give me new test scores so it looks like it did give me the same scores as the object on line 15. so I'm going to quickly go in and just change one of those to make it unique next I'm going to quickly show you how you can use a GitHub copilot chat to help find resources more pointedly without having to go and search in your browser so I'm going to open up GitHub copilot chat as you can see it gives me a little bit of a welcome and in this chat I'm going to ask it to take me to the link documentation and it's giving me the correct link to go there this just helps with productivity and finding help resources along the way without getting lost in Docs so I'm going to close that up and next I'm going to go ahead and create our link queries to query this data and what I'm going to do is look for students who received over a score of 90 on their first test so I'm going to go in on line 20 and once again I'm going to use a comment to provide some context to GitHub copilot and let it know what it what I'm doing [Applause] and as you saw copel is giving me some suggestions along the way but of course it doesn't know exactly what I want until I tell it and this suggestion looks pretty good so I'm gonna go ahead and use tab to accept the suggestion um if you ever forget how to accept it you can hover over this gray ghost text and it'll tell you exactly how great and next I'm going to want to execute that query so once again I'm going to go ahead I'm going to write a comment and it's already anticipating what I want which is pretty cool but I'm going to be a little bit more specific so I'm going to say execute query with student first name and last name it's always best practice to be as specific as possible with copilot because once again it can't read your mind all right this looks pretty good although the formatting is a little bit different than I would like to use so I'm actually going to correct Copilot because it didn't give me exactly what I was looking for so I'm going to go back in delete that and then I'm going to start writing what I'm looking for I'm going to save that and let's run it I'll open up my terminal I'll do dot net run awesome I did get a bit of a warning but for this demo I'm not going to worry about it and as you can see it gave me all of the names of the students who got greater than 90 on that first test but I'd like to be able to scan this a little bit easier maybe get some more information as to what score they actually received so I'm going to go ahead and modify the query so I'm going to start by going in on uh line 90 online 23 rather and I'm going to oh it's already giving me a pretty good suggestion but I'm going to go ahead and continue by asking copilot to order this by student score on the first test in descending order perfect that's exactly what I'm looking for so I'm going to go ahead and accept that and I'm going to edit this so that it prints out what I want and out student name and first test score all right this is not exactly what I'm looking for so I'm going to go back in and change this up foreign let's run that again and see what we get some more warnings but there you go it gave me exactly what I was looking for and co-pilot was pretty helpful in uh reducing the time it took me to get there
Info
Channel: Microsoft Visual Studio
Views: 15,417
Rating: undefined out of 5
Keywords: visual studio, GitHub Copilot, .NET
Id: 35DWTrMeseo
Channel Id: undefined
Length: 6min 35sec (395 seconds)
Published: Thu Aug 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.