Skip to content

Commit

Permalink
feat: Added .NET Standard 2.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
thargy committed Jan 21, 2022
1 parent ee9936b commit 2b4cc98
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
3 changes: 2 additions & 1 deletion DevDecoder.DynamicXml/DevDecoder.DynamicXml.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>DevDecoder.DynamicXml</RootNamespace>
<PackageId>DevDecoder.DynamicXml</PackageId>
Expand Down
22 changes: 0 additions & 22 deletions DevDecoder.DynamicXml/DynamicXObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,26 +229,4 @@ private static IEnumerable<IDynamicXFilter> Flatten(this object[] indices, bool
}
}
}


/// <summary>
/// Returns the number as an ordinal.
/// </summary>
/// <param name="number">The number</param>
/// <param name="provider">The format provider</param>
/// <returns>The ordinal string.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static string ToOrdinal(this long number, IFormatProvider? provider = null)
{
var abs = Math.Abs(number);
return abs / 10 == 1
? string.Create(provider, stackalloc char[64], $"{number}th")
: (abs % 10) switch
{
1 => string.Create(provider, stackalloc char[64], $"{number}st"),
2 => string.Create(provider, stackalloc char[64], $"{number}nd"),
3 => string.Create(provider, stackalloc char[64], $"{number}rd"),
_ => string.Create(provider, stackalloc char[64], $"{number}th")
};
}
}
13 changes: 13 additions & 0 deletions DevDecoder.DynamicXml/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.ComponentModel;

// SHIM To allow record support in .NET Standard
#if NETSTANDARD2_1
// ReSharper disable once CheckNamespace
namespace System.Runtime.CompilerServices
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class IsExternalInit
{
}
}
#endif

0 comments on commit 2b4cc98

Please sign in to comment.