This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OverloadResolutionPriorityTester.PrintItems(arrayTecnologias); | |
OverloadResolutionPriorityTester.PrintItems(listTecnologia); | |
OverloadResolutionPriorityTester.PrintItems("Visual Studio Code", "Visual Studio 2022", "Rider"); | |
OverloadResolutionPriorityTester.PrintItems(spanTecnologias); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)} ]"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)} - " + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |