Skip to content

Instantly share code, notes, and snippets.

View renatogroffe's full-sized avatar
🎯
Focusing

Renato Groffe renatogroffe

🎯
Focusing
  • Brazil
  • 14:08 (UTC -03:00)
View GitHub Profile
List<Guid> guidsV7Utc = new();
for (int i = 1; i <= 5; i++)
{
var guid = Guid.CreateVersion7(DateTimeOffset.UtcNow);
guidsV7Utc.Add(guid);
Console.WriteLine($"{guid} - versao {guid.Version}");
Thread.Sleep(1000);
}
Console.WriteLine();
List<Guid> guidsV7 = new();
for (int i = 1; i <= 5; i++)
{
var guid = Guid.CreateVersion7();
guidsV7.Add(guid);
Console.WriteLine($"{guid} - versao {guid.Version}");
Thread.Sleep(1000);
}
Console.WriteLine();
List<Guid> guidsV4 = new();
for (int i = 1; i <= 5; i++)
{
var guid = Guid.NewGuid();
guidsV4.Add(guid);
Console.WriteLine($"{guid} - versao {guid.Version}");
Thread.Sleep(1000);
}
Console.WriteLine();
using ConsoleAppFieldKeyword.Models;
using System.Runtime.InteropServices;
Console.WriteLine("***** Testes com .NET 9 + C# 13 | Field Keyword (Preview) *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
Console.WriteLine();
double[] temperaturasFahrenheit = [ 32, 80.5, - 600, 212, -100.7 ];
namespace ConsoleAppFieldKeyword.Models;
public class Temperatura
{
public double Fahrenheit
{
get;
set
{
if (value < -459.67)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>preview</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
namespace ConsoleAppFieldKeyword.Models;
public class Temperatura
{
private double _fahrenheit;
public double Fahrenheit
{
get => _fahrenheit;
set

Mermaid-Copilot

Exemplos de diagramas de Mermaid gerados com auxílio do GitHub Copilot.

Exemplo de autenticação via JWT

Dúvida enviada ao Copilot:

Gere um diagrama de sequência para Mermaid (código) detalhando como seria o fluxo de uma aplicação cliente que consome uma API REST protegida por tokens JWT. O token é obtido a partir de um Identity Provider (Microsoft Entra ID, Keycloak) e, uma vez que a aplicação receba esse token, o mesmo é utilizado para se fazer uma chamada a uma API REST protegida.

using System.Diagnostics;
using System.Runtime.InteropServices;
Console.WriteLine("***** Testes com .NET 9 | Melhorias em Debug.Assert *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
Console.WriteLine();
Console.WriteLine("Informe um numero inteiro positivo:");
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using System.Text.Json;
Console.WriteLine("***** Testes com .NET 9 | O tipo generico ReadOnlySet<T> *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
var campeoesMundiais = new HashSet<string>()