Skip to content

Instantly share code, notes, and snippets.

View renatogroffe's full-sized avatar
🎯
Focusing

Renato Groffe renatogroffe

🎯
Focusing
  • Brazil
  • 20:35 (UTC -03:00)
View GitHub Profile
using System.Text.Json;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenApi();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0-preview.4.25258.110" />
# pragma warning disable CS8625
using ConsoleAppNullConditionalAssignment.Models;
using System.Runtime.InteropServices;
using System.Text.Json;
Console.WriteLine("***** Testes com .NET 10 | Null-conditional assignment *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
</PropertyGroup>
namespace ConsoleAppNullConditionalAssignment.Models;
public class Produto
{
public string? Id { get; set; }
public string? Nome { get; set; }
public double? Preco { get; set; }
}
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" };