From b802059c042b2adc6ac6751be4432442d8932746 Mon Sep 17 00:00:00 2001 From: Martijn Bodeman <11424653+skwasjer@users.noreply.github.com> Date: Thu, 3 Oct 2024 01:57:18 +0200 Subject: [PATCH] feat: add JSON conversion support for Iban type for .NET Std 2.1 (#208) --- src/IbanNet/Iban.cs | 2 +- src/IbanNet/IbanNet.csproj | 1 + src/IbanNet/Json/IbanJsonConverter.cs | 2 +- test/IbanNet.Tests/Json/IbanJsonConverterTests.cs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/IbanNet/Iban.cs b/src/IbanNet/Iban.cs index 607ef4f1..8cef6e3f 100644 --- a/src/IbanNet/Iban.cs +++ b/src/IbanNet/Iban.cs @@ -13,7 +13,7 @@ namespace IbanNet; /// Represents an IBAN. /// [TypeConverter(typeof(IbanTypeConverter))] -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER [System.Text.Json.Serialization.JsonConverter(typeof(Json.IbanJsonConverter))] #endif public sealed class Iban diff --git a/src/IbanNet/IbanNet.csproj b/src/IbanNet/IbanNet.csproj index 0b422374..fc89e712 100644 --- a/src/IbanNet/IbanNet.csproj +++ b/src/IbanNet/IbanNet.csproj @@ -26,6 +26,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/IbanNet/Json/IbanJsonConverter.cs b/src/IbanNet/Json/IbanJsonConverter.cs index 92b9cb16..7e95f8c7 100644 --- a/src/IbanNet/Json/IbanJsonConverter.cs +++ b/src/IbanNet/Json/IbanJsonConverter.cs @@ -1,4 +1,4 @@ -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER using System.Text.Json; using System.Text.Json.Serialization; using IbanNet.Registry; diff --git a/test/IbanNet.Tests/Json/IbanJsonConverterTests.cs b/test/IbanNet.Tests/Json/IbanJsonConverterTests.cs index 82cc1672..744a5a84 100644 --- a/test/IbanNet.Tests/Json/IbanJsonConverterTests.cs +++ b/test/IbanNet.Tests/Json/IbanJsonConverterTests.cs @@ -1,4 +1,4 @@ -#if NET6_0_OR_GREATER +#if NET5_0_OR_GREATER using System.Text; using System.Text.Json; using IbanNet.Registry;