Skip to content

Instantly share code, notes, and snippets.

View renatogroffe's full-sized avatar
🎯
Focusing

Renato Groffe renatogroffe

🎯
Focusing
  • Brazil
  • 16:56 (UTC -03:00)
View GitHub Profile
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text.Json;
Console.WriteLine("***** Testes com .NET 10 | Numeric Ordering for String Comparison *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
Console.WriteLine();
using System.Globalization;
using System.Runtime.InteropServices;
Console.WriteLine("***** Testes com .NET 10 | Novos overloads na classe estatica ISOWeek *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
var currentDate = DateOnly.FromDateTime(DateTime.Now);
Console.WriteLine();
using System.Globalization;
using System.Runtime.InteropServices;
Console.WriteLine("***** Testes com .NET 10 | Novos overloads na classe estatica ISOWeek *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
var currentDate = DateOnly.FromDateTime(DateTime.Now);
Console.WriteLine();
public static class ISOWeek
{
// Novas sobrecargas
public static int GetWeekOfYear(DateOnly date);
public static int GetYear(DateOnly date);
public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek);
}
using ConsoleAppOverloadResolution.Tests;
using System.Runtime.InteropServices;
Console.WriteLine("***** Testes com .NET 9 + C# 13 | Overload Resolution *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
Console.WriteLine();
var arrayTecnologias = new string[] { "C#", ".NET", "ASP.NET Core" };
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++)