Skip to content

Instantly share code, notes, and snippets.

View renatogroffe's full-sized avatar
🎯
Focusing

Renato Groffe renatogroffe

🎯
Focusing
  • Brazil
  • 11:23 (UTC -03:00)
View GitHub Profile
OverloadResolutionPriorityTester.PrintItems(arrayTecnologias);
OverloadResolutionPriorityTester.PrintItems(listTecnologia);
OverloadResolutionPriorityTester.PrintItems("Visual Studio Code", "Visual Studio 2022", "Rider");
OverloadResolutionPriorityTester.PrintItems(spanTecnologias);
using System.Runtime.CompilerServices;
namespace ConsoleAppOverloadResolution.Tests;
public class OverloadResolutionPriorityTester
{
[OverloadResolutionPriority(1)]
public static void PrintItems(params string[] items)
=> Console.WriteLine($"{nameof(OverloadResolutionPriorityTester)} - " +
$"string[]: [ {String.Join(" | ", items)} ]");
var arrayTecnologias = new string[] { "C#", ".NET", "ASP.NET Core" };
ReadOnlySpan<string?> spanTecnologias = ["Docker", "Kubernetes", "Linux"];
List<string> listTecnologia = [ "SQL Server", "Redis", "PostgreSQL" ]
OverloadResolutionTester.PrintItems(arrayTecnologias);
OverloadResolutionTester.PrintItems(listTecnologia);
OverloadResolutionTester.PrintItems("Visual Studio Code", "Visual Studio 2022", "Rider");
OverloadResolutionTester.PrintItems(spanTecnologias);
namespace ConsoleAppOverloadResolution.Tests;
public static class OverloadResolutionTester
{
public static void PrintItems(params string[] items)
=> Console.WriteLine($"{nameof(OverloadResolutionTester)} - " +
$"string[]: [ {String.Join(" | ", items)} ]");
public static void PrintItems(params ReadOnlySpan<string?> items)
=> Console.WriteLine($"{nameof(OverloadResolutionTester)} - " +
using System.Runtime.InteropServices;
using System.Text.Json;
Console.WriteLine("***** Testes com .NET 9 | GUIDs UUID Version 7 *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
List<Guid> guidsV4 = new();
for (int i = 1; i <= 5; i++)
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)