diff --git a/X10D/X10D.csproj b/X10D/X10D.csproj
index 86237b6..97996b3 100644
--- a/X10D/X10D.csproj
+++ b/X10D/X10D.csproj
@@ -5,6 +5,7 @@
10.0
true
false
+ true
Oliver Booth
en
true
diff --git a/X10D/src/BooleanExtensions/BooleanExtensions.cs b/X10D/src/BooleanExtensions/BooleanExtensions.cs
index caa4906..71710e5 100644
--- a/X10D/src/BooleanExtensions/BooleanExtensions.cs
+++ b/X10D/src/BooleanExtensions/BooleanExtensions.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace X10D
+namespace X10D
{
///
/// Extension methods for .
diff --git a/X10D/src/CharExtensions/CharExtensions.cs b/X10D/src/CharExtensions/CharExtensions.cs
index 6e45086..ee7272b 100644
--- a/X10D/src/CharExtensions/CharExtensions.cs
+++ b/X10D/src/CharExtensions/CharExtensions.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace X10D
+namespace X10D
{
///
/// Extension methods for .
diff --git a/X10D/src/CollectionExtensions/CollectionExtensions.cs b/X10D/src/CollectionExtensions/CollectionExtensions.cs
index c10f765..11fc124 100644
--- a/X10D/src/CollectionExtensions/CollectionExtensions.cs
+++ b/X10D/src/CollectionExtensions/CollectionExtensions.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace X10D
+namespace X10D
{
///
/// Extension methods for and .
diff --git a/X10D/src/ComparableExtensions/ComparableExtensions.cs b/X10D/src/ComparableExtensions/ComparableExtensions.cs
index 857cee1..3aa1650 100644
--- a/X10D/src/ComparableExtensions/ComparableExtensions.cs
+++ b/X10D/src/ComparableExtensions/ComparableExtensions.cs
@@ -1,4 +1,3 @@
-using System;
using System.Globalization;
namespace X10D
diff --git a/X10D/src/DictionaryExtensions/DictionaryExtensions.cs b/X10D/src/DictionaryExtensions/DictionaryExtensions.cs
index 4040460..f51c9a2 100644
--- a/X10D/src/DictionaryExtensions/DictionaryExtensions.cs
+++ b/X10D/src/DictionaryExtensions/DictionaryExtensions.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Collections.Generic;
using System.Web;
namespace X10D
diff --git a/X10D/src/DoubleExtensions/DoubleExtensions.cs b/X10D/src/DoubleExtensions/DoubleExtensions.cs
index b37cd61..6c998d4 100644
--- a/X10D/src/DoubleExtensions/DoubleExtensions.cs
+++ b/X10D/src/DoubleExtensions/DoubleExtensions.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace X10D
{
///
diff --git a/X10D/src/Int16Extensions/Int16Extensions.cs b/X10D/src/Int16Extensions/Int16Extensions.cs
index 7395943..20934c6 100644
--- a/X10D/src/Int16Extensions/Int16Extensions.cs
+++ b/X10D/src/Int16Extensions/Int16Extensions.cs
@@ -1,4 +1,3 @@
-using System;
using System.Net;
namespace X10D
diff --git a/X10D/src/Int32Extensions/Int32Extensions.cs b/X10D/src/Int32Extensions/Int32Extensions.cs
index ce22e97..c0f3e17 100644
--- a/X10D/src/Int32Extensions/Int32Extensions.cs
+++ b/X10D/src/Int32Extensions/Int32Extensions.cs
@@ -1,4 +1,3 @@
-using System;
using System.Net;
namespace X10D
diff --git a/X10D/src/Int64Extensions/Int64Extensions.cs b/X10D/src/Int64Extensions/Int64Extensions.cs
index da43cea..7d79f72 100644
--- a/X10D/src/Int64Extensions/Int64Extensions.cs
+++ b/X10D/src/Int64Extensions/Int64Extensions.cs
@@ -1,4 +1,3 @@
-using System;
using System.Net;
namespace X10D
diff --git a/X10D/src/ListExtensions/ListExtensions.cs b/X10D/src/ListExtensions/ListExtensions.cs
index ce2e2db..cadc73a 100644
--- a/X10D/src/ListExtensions/ListExtensions.cs
+++ b/X10D/src/ListExtensions/ListExtensions.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-
-namespace X10D
+namespace X10D
{
///
/// Extension methods for and .
diff --git a/X10D/src/RandomExtensions/RandomExtensions.cs b/X10D/src/RandomExtensions/RandomExtensions.cs
index 7f37561..1d1a9c8 100644
--- a/X10D/src/RandomExtensions/RandomExtensions.cs
+++ b/X10D/src/RandomExtensions/RandomExtensions.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
-using System.Linq;
using System.Text;
namespace X10D
diff --git a/X10D/src/RandomExtensions/SystemNumerics/RandomExtensions.Numerics.cs b/X10D/src/RandomExtensions/SystemNumerics/RandomExtensions.Numerics.cs
index 5d5d458..b19c3d0 100644
--- a/X10D/src/RandomExtensions/SystemNumerics/RandomExtensions.Numerics.cs
+++ b/X10D/src/RandomExtensions/SystemNumerics/RandomExtensions.Numerics.cs
@@ -1,5 +1,3 @@
-#if NET5_0
-using System;
using System.Numerics;
namespace X10D.SystemNumerics
@@ -116,5 +114,3 @@ namespace X10D.SystemNumerics
}
}
}
-
-#endif
diff --git a/X10D/src/ReflectionExtensions/MemberInfoExtensions.cs b/X10D/src/ReflectionExtensions/MemberInfoExtensions.cs
index a661b9b..2b9e9c0 100644
--- a/X10D/src/ReflectionExtensions/MemberInfoExtensions.cs
+++ b/X10D/src/ReflectionExtensions/MemberInfoExtensions.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Globalization;
+using System.Globalization;
using System.Reflection;
namespace X10D
diff --git a/X10D/src/ReflectionExtensions/TypeExtensions.cs b/X10D/src/ReflectionExtensions/TypeExtensions.cs
index a22992b..3843fda 100644
--- a/X10D/src/ReflectionExtensions/TypeExtensions.cs
+++ b/X10D/src/ReflectionExtensions/TypeExtensions.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Globalization;
+using System.Globalization;
using System.Reflection;
namespace X10D
diff --git a/X10D/src/SingleExtensions/SingleExtensions.cs b/X10D/src/SingleExtensions/SingleExtensions.cs
index b2ef168..a61e2a6 100644
--- a/X10D/src/SingleExtensions/SingleExtensions.cs
+++ b/X10D/src/SingleExtensions/SingleExtensions.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace X10D
{
///
diff --git a/X10D/src/StreamExtensions/StreamExtensions.Internal.cs b/X10D/src/StreamExtensions/StreamExtensions.Internal.cs
index c88c947..2fa089a 100644
--- a/X10D/src/StreamExtensions/StreamExtensions.Internal.cs
+++ b/X10D/src/StreamExtensions/StreamExtensions.Internal.cs
@@ -1,7 +1,4 @@
-using System;
-using System.IO;
-
-namespace X10D
+namespace X10D
{
public static partial class StreamExtensions
{
@@ -32,13 +29,11 @@ namespace X10D
return (int)(stream.Position - preWritePosition);
}
-#if NET5_0
private static int WriteInternal(this Stream stream, Span value)
{
var preWritePosition = stream.Position;
stream.Write(value);
return (int)(stream.Position - preWritePosition);
}
-#endif
}
}
diff --git a/X10D/src/StreamExtensions/StreamExtensions.cs b/X10D/src/StreamExtensions/StreamExtensions.cs
index b0cc911..a559fc0 100644
--- a/X10D/src/StreamExtensions/StreamExtensions.cs
+++ b/X10D/src/StreamExtensions/StreamExtensions.cs
@@ -1,10 +1,6 @@
-using System;
-using System.IO;
-using System.Reflection;
+using System.Reflection;
using System.Security.Cryptography;
-#if NET5_0
using System.Buffers.Binary;
-#endif
namespace X10D
{
@@ -135,17 +131,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadDoubleLittleEndian(buffer)
: BinaryPrimitives.ReadDoubleBigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToDouble(value, 0);
-#endif
}
///
@@ -178,17 +170,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadInt16LittleEndian(buffer)
: BinaryPrimitives.ReadInt16BigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToInt16(value, 0);
-#endif
}
///
@@ -221,17 +209,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadInt32LittleEndian(buffer)
: BinaryPrimitives.ReadInt32BigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToInt32(value, 0);
-#endif
}
///
@@ -264,17 +248,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadInt64LittleEndian(buffer)
: BinaryPrimitives.ReadInt64BigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToInt64(value, 0);
-#endif
}
///
@@ -307,17 +287,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadSingleLittleEndian(buffer)
: BinaryPrimitives.ReadSingleBigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToSingle(value, 0);
-#endif
}
///
@@ -352,17 +328,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadUInt16LittleEndian(buffer)
: BinaryPrimitives.ReadUInt16BigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToUInt16(value, 0);
-#endif
}
///
@@ -397,17 +369,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadUInt32LittleEndian(buffer)
: BinaryPrimitives.ReadUInt32BigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToUInt32(value, 0);
-#endif
}
///
@@ -442,17 +410,13 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
stream.Read(buffer);
return endianness == Endianness.LittleEndian
? BinaryPrimitives.ReadUInt64LittleEndian(buffer)
: BinaryPrimitives.ReadUInt64BigEndian(buffer);
-#else
- var value = ReadInternal(stream, endianness);
- return BitConverter.ToUInt64(value, 0);
-#endif
}
///
@@ -487,7 +451,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(short)];
if (endianness == Endianness.LittleEndian)
@@ -500,10 +464,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
@@ -538,7 +498,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(int)];
if (endianness == Endianness.LittleEndian)
@@ -551,10 +511,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
@@ -589,7 +545,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(long)];
if (endianness == Endianness.LittleEndian)
@@ -602,10 +558,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
@@ -642,7 +594,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(ushort)];
if (endianness == Endianness.LittleEndian)
@@ -655,10 +607,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
@@ -695,7 +643,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(uint)];
if (endianness == Endianness.LittleEndian)
@@ -708,10 +656,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
@@ -748,7 +692,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(ulong)];
if (endianness == Endianness.LittleEndian)
@@ -761,10 +705,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
@@ -787,7 +727,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(float)];
if (endianness == Endianness.LittleEndian)
@@ -800,10 +740,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
@@ -826,7 +762,7 @@ namespace X10D
throw new ArgumentOutOfRangeException(nameof(endianness));
}
-#if NET5_0
+
Span buffer = stackalloc byte[sizeof(double)];
if (endianness == Endianness.LittleEndian)
@@ -839,10 +775,6 @@ namespace X10D
}
return stream.WriteInternal(buffer);
-#else
- var buffer = BitConverter.GetBytes(value);
- return stream.WriteInternal(buffer, endianness);
-#endif
}
///
diff --git a/X10D/src/StringExtensions/StringExtensions.cs b/X10D/src/StringExtensions/StringExtensions.cs
index 7bbfaad..527b026 100644
--- a/X10D/src/StringExtensions/StringExtensions.cs
+++ b/X10D/src/StringExtensions/StringExtensions.cs
@@ -1,6 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Text;
namespace X10D
@@ -136,16 +133,7 @@ namespace X10D
throw new ArgumentException(Resource.EnumParseEmptyStringException, nameof(value));
}
-#if NET5_0_OR_GREATER
return Enum.Parse(value, ignoreCase);
-#else
- if (typeof(T) is not { IsEnum: true } type)
- {
- throw new ArgumentException(Resource.EnumParseNotEnumException);
- }
-
- return (T)Enum.Parse(type, value, ignoreCase);
-#endif
}
///
diff --git a/X10D/src/TimeSpanParser.cs b/X10D/src/TimeSpanParser.cs
index 270f509..ba7d76f 100644
--- a/X10D/src/TimeSpanParser.cs
+++ b/X10D/src/TimeSpanParser.cs
@@ -1,4 +1,3 @@
-using System;
using System.Globalization;
using System.Text.RegularExpressions;
diff --git a/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs b/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs
index 7fb1ba6..cf55d47 100644
--- a/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs
+++ b/X10D/src/WaitHandleExtensions/WaitHandleExtensions.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace X10D
+namespace X10D
{
///
/// Extension methods for .