using System; using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; namespace CryptoExchange.Net.Converters.SystemTextJson { /// /// Converter for serializing enum values as int /// public class EnumIntWriterConverter : JsonConverter where T: struct, Enum { /// public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { throw new NotImplementedException(); } /// public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) => writer.WriteNumberValue((int)(object)value); } }