Skip to content

Instantly share code, notes, and snippets.

@renatogroffe
Created February 24, 2024 14:34
Show Gist options
  • Save renatogroffe/a8063e455f70c9aa54b4987d4fbdcd09 to your computer and use it in GitHub Desktop.
Save renatogroffe/a8063e455f70c9aa54b4987d4fbdcd09 to your computer and use it in GitHub Desktop.
using ConsoleAppDefaultWebOptions.Models;
using System.Runtime.InteropServices;
using System.Text.Json;
Console.WriteLine("***** Testes com .NET 9 | Serializacao com Default web options *****");
Console.WriteLine($"Versao do .NET em uso: {RuntimeInformation
.FrameworkDescription} - Ambiente: {Environment.MachineName} - Kernel: {Environment
.OSVersion.VersionString}");
var localidades = new Localidade[]
{
new () { Id = 1, NomeCidade = "Sao Paulo", NomePais = "Brasil", NomeContinente = "America do Sul" },
new () { Id = 2, NomeCidade = "Roma", NomePais = "Italia", NomeContinente = "Europa" }
};
Console.WriteLine();
Console.WriteLine("*** Resultados da serializacao ***");
foreach (var localidade in localidades)
{
Console.WriteLine();
Console.WriteLine(JsonSerializer.Serialize(localidade, JsonSerializerOptions.Web));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment