From 3cdcf0d9be3bf88bfe1d181657e68769dd200080 Mon Sep 17 00:00:00 2001 From: JKorf Date: Fri, 29 Mar 2024 15:55:19 +0100 Subject: [PATCH] Improved SystemTextJson message accessor value retrieval --- .../SystemTextJson/SystemTextJsonMessageAccessor.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/CryptoExchange.Net/Converters/SystemTextJson/SystemTextJsonMessageAccessor.cs b/CryptoExchange.Net/Converters/SystemTextJson/SystemTextJsonMessageAccessor.cs index 7a26c5cd..81c34746 100644 --- a/CryptoExchange.Net/Converters/SystemTextJson/SystemTextJsonMessageAccessor.cs +++ b/CryptoExchange.Net/Converters/SystemTextJson/SystemTextJsonMessageAccessor.cs @@ -118,17 +118,7 @@ public CallResult Deserialize(MessagePath? path = null) if (value.Value.ValueKind == JsonValueKind.Object || value.Value.ValueKind == JsonValueKind.Array) return default; - var ttype = typeof(T); - if (ttype == typeof(string)) - return (T?)(object?)value.Value.GetString(); - if (ttype == typeof(short)) - return (T)(object)value.Value.GetInt16(); - if (ttype == typeof(int)) - return (T)(object)value.Value.GetInt32(); - if (ttype == typeof(long)) - return (T)(object)value.Value.GetInt64(); - - return default; + return value.Value.Deserialize(); } ///