mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-12 00:43:03 +00:00
2fb3442800
Initial support for System.Text.Json and some refactoring
24 lines
783 B
C#
24 lines
783 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace CryptoExchange.Net.Converters.SystemTextJson
|
|
{
|
|
/// <summary>
|
|
/// Converter for serializing decimal values as string
|
|
/// </summary>
|
|
public class DecimalStringWriterConverter : JsonConverter<decimal>
|
|
{
|
|
/// <inheritdoc />
|
|
public override decimal Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options)
|
|
=> writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture) ?? null);
|
|
}
|
|
}
|