Start Debugging
2023-09-07 更新日 2023-11-12 csharpdotnetdotnet-8 Edit on GitHub

.NET 8 Half、Int128、UInt128 のシリアライズ

.NET 8 の System.Text.Json は、Half、Int128、UInt128 という数値型のシリアライズに、組み込みで対応するようになりました。

System.Text.Json は、追加の型に対する組み込みのサポートを提供します。

例を見てみましょう。

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.

< 戻る