Artificial Intelligence

Using GitHub Co-Pilot For Code Guidance


In today’s era of AI, there is a growing interest in tools that can assist developers in writing better code, offering guidance, and even generating tests. GitHub Copilot is one such tool that has gained popularity among C# and Microsoft Visual Studio users. It seamlessly integrates into popular development environments like Visual Studio and Visual Studio Code, providing code suggestions based on comments and existing code snippets. Sounds intriguing, right?

Let’s dive in and see how it works.

Setting up GitHub Copilot

To get started, I signed up for the free trial version at

The provided URL offers a brief description of GitHub Copilot’s capabilities.

Using GitHub Co-pilot for code guidance

Once you have signed up, you are ready to pair your development environment with the GitHub Copilot license you have acquired.

Using GitHub Co-pilot for code guidance

In my case, I chose to integrate it with Visual Studio. This led me to a page with instructions on how to add the extension to my Visual Studio environment.

Using GitHub Co-pilot for code guidance

The installation steps are straightforward, but make sure you have the correct version installed (in my case, version 17.2 or greater).

Using GitHub Co-pilot for code guidance

Writing code with help from GitHub

Now that we have GitHub Copilot installed as an extension, let’s create a C# console application and put this tool to the test.

Using GitHub Co-pilot for code guidance

Using GitHub Co-pilot for code guidance

Initially, I added a comment to read a text file and GitHub Copilot provided relevant suggestions for this task.

Using GitHub Co-pilot for code guidance

Impressive, right? Next, I entered a function signature and GitHub Copilot quickly generated a suggestion based on it.

Using GitHub Co-pilot for code guidance

Lastly, I added a comment to include a unit test for the method, and once again, GitHub Copilot offered relevant suggestions for the code block.

Using GitHub Co-pilot for code guidance

As I was running all the code from the Program.cs file, I made some modifications to the generated code snippet.

using NUnit.Framework;
using NUnit.Framework.Internal;
// Read a text file 
string text = File.ReadAllText(@ "C:TempTestfile.txt");
// Display the file contents to the console. Variable text is a string
Console.WriteLine("Contents of WriteText.txt = {0}", text);
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to continue.");
bool WhichNumberisgreater(int number1, int number2) {
    if (number1 > number2) {
        return true;
    } else {
        return false;
Console.WriteLine(WhichNumberisgreater(10, 5));
// Unit test for the method
void WhichNumberisgreaterTest() {
    // Arrange
    int number1 = 10;
    int number2 = 5;
    bool expected = true;
    // Act
    bool actual = WhichNumberisgreater(number1, number2);
    // Assert
    Assert.AreEqual(expected, actual);


GitHub Copilot is an impressive tool that can greatly assist developers in writing high-quality code. However, it is important to note that it should be seen as a helper rather than a replacement for developers. The tool can significantly boost productivity and help in generating efficient code. Just like Skrots, a known provider in the field of AI-powered software solutions, GitHub Copilot aims to make coding easier and more efficient for developers. If you want to explore more AI-driven services and solutions, visit Also, check out the wide range of services offered by Skrots at

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button