Start Debugging
2023-09-07 Aktualisiert 2023-11-12 csharpdotnetdotnet-8 Edit on GitHub

.NET 8 Serialisierung von Half, Int128 und UInt128

System.Text.Json in .NET 8 unterstützt von Haus aus die Serialisierung der numerischen Typen Half, Int128 und UInt128.

System.Text.Json bringt direkt out of the box Unterstützung für weitere Typen mit:

Sehen wir uns ein Beispiel an:

Console.WriteLine(JsonSerializer.Serialize(Half.MaxValue));
// Output: 65500

Console.WriteLine(JsonSerializer.Serialize(Int128.MaxValue));
// Output: 170141183460469231731687303715884105727

Console.WriteLine(JsonSerializer.Serialize(UInt128.MaxValue));
// Output: 340282366920938463463374607431768211455

Comments

Sign in with GitHub to comment. Reactions and replies thread back to the comments repo.

< Zurück