I used mostly Copilot with Python, and I have to admit that it generates super accurate Machine Learning and TensorFlow code. I don’t to a lot of C# code in Visual Studio Code, I’m old school I use Visual Studio 2022 for C#. However, I decided to give it a try and here are the results.
Let’s start with the Hello World in CoPilot, let’s add 2 numbers.
It works great, let’s generate a more complex scenario.
So far, so good!
Copilot and Code Block suggestions in C#
However, in the previous animations you can see that CoPilot behavior is different in C#, it suggest line by line, not a code block.
There is an easy hack for this, instead of accepting each line, we can open the CoPilot editor with the shortcut CTRL + ENTER and we can check the top 10 CoPilot code suggestions. From there we can add the C# code block to our code.
Generating Unit Tests
How about Unit Tests ? I know that it’s will generate some code, and I was wondering what it will do. This is a simple CS file, it does not belong to a C# project, so there are no references to any Unit Test framework. The output is awesome.
As you can see in the animation below, from the code editor suggestions, some options does not makes sense, however there are 2 that really nails and test a simple Add() function !
Generating Connection Strings or Azure Keys
And I leave this one to the end, how about connection strings? CoPilot was trained on public code, and I’m sure that there are no connection strings or azure keys in GitHub. The generated output is great, I’ll leave it to you to think about this.
That’s it’s for today. Remember that you can take a look at the 75 min review (in Spanish) that we did with my friends from CampusMVP here.
GitHubCopilot 🤖: qué es, cómo funciona y el impacto futuro de la IA en el trabajo de programador. Grabación
¿Con ganas de ponerte al día?
En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:
- Si tienes ganas de ponerte al día con Front End (ES6, Typescript, React, Angular, Vuejs…) te recomendamos nuestros Máster Front End: https://lemoncode.net/master-frontend#inicio-banner
- Si te quieres poner al día en Backend (stacks .net y nodejs), te aconsejamos nuestro Bootcamp Backend: https://lemoncode.net/bootcamp-backend#bootcamp-backend/banner
- Y si tienes ganas de meterte con Docker, Kubernetes, CI/CD…, tenemos nuestro Bootcamp Devops: https://lemoncode.net/bootcamp-devops#bootcamp-devops/inicio