mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 00:18:47 +00:00
style: cluster throw helpers together to reduce branch repetition
This commit is contained in:
parent
431e72a4c1
commit
39c8c7defb
@ -1,4 +1,4 @@
|
|||||||
using System.Diagnostics.Contracts;
|
using System.Diagnostics.Contracts;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
@ -37,15 +37,13 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(dictionary);
|
ArgumentNullException.ThrowIfNull(dictionary);
|
||||||
|
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
||||||
#else
|
#else
|
||||||
if (dictionary is null)
|
if (dictionary is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(dictionary));
|
throw new ArgumentNullException(nameof(dictionary));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
|
||||||
#else
|
|
||||||
if (updateValueFactory is null)
|
if (updateValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(updateValueFactory));
|
throw new ArgumentNullException(nameof(updateValueFactory));
|
||||||
@ -108,15 +106,13 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(dictionary);
|
ArgumentNullException.ThrowIfNull(dictionary);
|
||||||
|
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
||||||
#else
|
#else
|
||||||
if (dictionary is null)
|
if (dictionary is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(dictionary));
|
throw new ArgumentNullException(nameof(dictionary));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
|
||||||
#else
|
|
||||||
if (updateValueFactory is null)
|
if (updateValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(updateValueFactory));
|
throw new ArgumentNullException(nameof(updateValueFactory));
|
||||||
@ -167,23 +163,19 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(dictionary);
|
ArgumentNullException.ThrowIfNull(dictionary);
|
||||||
|
ArgumentNullException.ThrowIfNull(addValueFactory);
|
||||||
|
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
||||||
#else
|
#else
|
||||||
if (dictionary is null)
|
if (dictionary is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(dictionary));
|
throw new ArgumentNullException(nameof(dictionary));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(addValueFactory);
|
|
||||||
#else
|
|
||||||
if (addValueFactory is null)
|
if (addValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(addValueFactory));
|
throw new ArgumentNullException(nameof(addValueFactory));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
|
||||||
#else
|
|
||||||
if (updateValueFactory is null)
|
if (updateValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(updateValueFactory));
|
throw new ArgumentNullException(nameof(updateValueFactory));
|
||||||
@ -250,23 +242,19 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(dictionary);
|
ArgumentNullException.ThrowIfNull(dictionary);
|
||||||
|
ArgumentNullException.ThrowIfNull(addValueFactory);
|
||||||
|
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
||||||
#else
|
#else
|
||||||
if (dictionary is null)
|
if (dictionary is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(dictionary));
|
throw new ArgumentNullException(nameof(dictionary));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(addValueFactory);
|
|
||||||
#else
|
|
||||||
if (addValueFactory is null)
|
if (addValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(addValueFactory));
|
throw new ArgumentNullException(nameof(addValueFactory));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
|
||||||
#else
|
|
||||||
if (updateValueFactory is null)
|
if (updateValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(updateValueFactory));
|
throw new ArgumentNullException(nameof(updateValueFactory));
|
||||||
@ -325,23 +313,19 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(dictionary);
|
ArgumentNullException.ThrowIfNull(dictionary);
|
||||||
|
ArgumentNullException.ThrowIfNull(addValueFactory);
|
||||||
|
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
||||||
#else
|
#else
|
||||||
if (dictionary is null)
|
if (dictionary is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(dictionary));
|
throw new ArgumentNullException(nameof(dictionary));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(addValueFactory);
|
|
||||||
#else
|
|
||||||
if (addValueFactory is null)
|
if (addValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(addValueFactory));
|
throw new ArgumentNullException(nameof(addValueFactory));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
|
||||||
#else
|
|
||||||
if (updateValueFactory is null)
|
if (updateValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(updateValueFactory));
|
throw new ArgumentNullException(nameof(updateValueFactory));
|
||||||
@ -414,23 +398,19 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(dictionary);
|
ArgumentNullException.ThrowIfNull(dictionary);
|
||||||
|
ArgumentNullException.ThrowIfNull(addValueFactory);
|
||||||
|
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
||||||
#else
|
#else
|
||||||
if (dictionary is null)
|
if (dictionary is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(dictionary));
|
throw new ArgumentNullException(nameof(dictionary));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(addValueFactory);
|
|
||||||
#else
|
|
||||||
if (addValueFactory is null)
|
if (addValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(addValueFactory));
|
throw new ArgumentNullException(nameof(addValueFactory));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(updateValueFactory);
|
|
||||||
#else
|
|
||||||
if (updateValueFactory is null)
|
if (updateValueFactory is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(updateValueFactory));
|
throw new ArgumentNullException(nameof(updateValueFactory));
|
||||||
@ -514,15 +494,13 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(source);
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
|
ArgumentNullException.ThrowIfNull(selector);
|
||||||
#else
|
#else
|
||||||
if (source is null)
|
if (source is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(source));
|
throw new ArgumentNullException(nameof(source));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(selector);
|
|
||||||
#else
|
|
||||||
if (selector is null)
|
if (selector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(selector));
|
throw new ArgumentNullException(nameof(selector));
|
||||||
@ -575,23 +553,19 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(source);
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
|
ArgumentNullException.ThrowIfNull(keySelector);
|
||||||
|
ArgumentNullException.ThrowIfNull(valueSelector);
|
||||||
#else
|
#else
|
||||||
if (source is null)
|
if (source is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(source));
|
throw new ArgumentNullException(nameof(source));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(keySelector);
|
|
||||||
#else
|
|
||||||
if (keySelector is null)
|
if (keySelector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(keySelector));
|
throw new ArgumentNullException(nameof(keySelector));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(valueSelector);
|
|
||||||
#else
|
|
||||||
if (valueSelector is null)
|
if (valueSelector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(valueSelector));
|
throw new ArgumentNullException(nameof(valueSelector));
|
||||||
@ -669,15 +643,13 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(source);
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
|
ArgumentNullException.ThrowIfNull(selector);
|
||||||
#else
|
#else
|
||||||
if (source is null)
|
if (source is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(source));
|
throw new ArgumentNullException(nameof(source));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(selector);
|
|
||||||
#else
|
|
||||||
if (selector is null)
|
if (selector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(selector));
|
throw new ArgumentNullException(nameof(selector));
|
||||||
@ -722,23 +694,19 @@ public static class DictionaryExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(source);
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
|
ArgumentNullException.ThrowIfNull(keySelector);
|
||||||
|
ArgumentNullException.ThrowIfNull(valueSelector);
|
||||||
#else
|
#else
|
||||||
if (source is null)
|
if (source is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(source));
|
throw new ArgumentNullException(nameof(source));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(keySelector);
|
|
||||||
#else
|
|
||||||
if (keySelector is null)
|
if (keySelector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(keySelector));
|
throw new ArgumentNullException(nameof(keySelector));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(valueSelector);
|
|
||||||
#else
|
|
||||||
if (valueSelector is null)
|
if (valueSelector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(valueSelector));
|
throw new ArgumentNullException(nameof(valueSelector));
|
||||||
|
@ -157,15 +157,13 @@ public static class RandomExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(random);
|
ArgumentNullException.ThrowIfNull(random);
|
||||||
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
#else
|
#else
|
||||||
if (random is null)
|
if (random is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(random));
|
throw new ArgumentNullException(nameof(random));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(source);
|
|
||||||
#else
|
|
||||||
if (source is null)
|
if (source is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(source));
|
throw new ArgumentNullException(nameof(source));
|
||||||
@ -534,15 +532,13 @@ public static class RandomExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(random);
|
ArgumentNullException.ThrowIfNull(random);
|
||||||
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
#else
|
#else
|
||||||
if (random is null)
|
if (random is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(random));
|
throw new ArgumentNullException(nameof(random));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(source);
|
|
||||||
#else
|
|
||||||
if (source is null)
|
if (source is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(source));
|
throw new ArgumentNullException(nameof(source));
|
||||||
|
@ -210,15 +210,13 @@ public static class ListOfByteExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(source);
|
ArgumentNullException.ThrowIfNull(source);
|
||||||
|
ArgumentNullException.ThrowIfNull(encoding);
|
||||||
#else
|
#else
|
||||||
if (source is null)
|
if (source is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(source));
|
throw new ArgumentNullException(nameof(source));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(encoding);
|
|
||||||
#else
|
|
||||||
if (encoding is null)
|
if (encoding is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(encoding));
|
throw new ArgumentNullException(nameof(encoding));
|
||||||
|
@ -60,15 +60,13 @@ public static class MemberInfoExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(member);
|
ArgumentNullException.ThrowIfNull(member);
|
||||||
|
ArgumentNullException.ThrowIfNull(attribute);
|
||||||
#else
|
#else
|
||||||
if (member is null)
|
if (member is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(member));
|
throw new ArgumentNullException(nameof(member));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(attribute);
|
|
||||||
#else
|
|
||||||
if (attribute is null)
|
if (attribute is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(attribute));
|
throw new ArgumentNullException(nameof(attribute));
|
||||||
@ -105,15 +103,13 @@ public static class MemberInfoExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(member);
|
ArgumentNullException.ThrowIfNull(member);
|
||||||
|
ArgumentNullException.ThrowIfNull(selector);
|
||||||
#else
|
#else
|
||||||
if (member is null)
|
if (member is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(member));
|
throw new ArgumentNullException(nameof(member));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(selector);
|
|
||||||
#else
|
|
||||||
if (selector is null)
|
if (selector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(selector));
|
throw new ArgumentNullException(nameof(selector));
|
||||||
@ -145,15 +141,13 @@ public static class MemberInfoExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(member);
|
ArgumentNullException.ThrowIfNull(member);
|
||||||
|
ArgumentNullException.ThrowIfNull(selector);
|
||||||
#else
|
#else
|
||||||
if (member is null)
|
if (member is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(member));
|
throw new ArgumentNullException(nameof(member));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(selector);
|
|
||||||
#else
|
|
||||||
if (selector is null)
|
if (selector is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(selector));
|
throw new ArgumentNullException(nameof(selector));
|
||||||
|
@ -57,15 +57,13 @@ public static class TypeExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(value);
|
ArgumentNullException.ThrowIfNull(value);
|
||||||
|
ArgumentNullException.ThrowIfNull(interfaceType);
|
||||||
#else
|
#else
|
||||||
if (value is null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(value));
|
throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(interfaceType);
|
|
||||||
#else
|
|
||||||
if (interfaceType is null)
|
if (interfaceType is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(interfaceType));
|
throw new ArgumentNullException(nameof(interfaceType));
|
||||||
@ -144,15 +142,13 @@ public static class TypeExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(value);
|
ArgumentNullException.ThrowIfNull(value);
|
||||||
|
ArgumentNullException.ThrowIfNull(type);
|
||||||
#else
|
#else
|
||||||
if (value is null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(value));
|
throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(type);
|
|
||||||
#else
|
|
||||||
if (type is null)
|
if (type is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(type));
|
throw new ArgumentNullException(nameof(type));
|
||||||
|
@ -136,23 +136,19 @@ public static class StringExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(value);
|
ArgumentNullException.ThrowIfNull(value);
|
||||||
|
ArgumentNullException.ThrowIfNull(sourceEncoding);
|
||||||
|
ArgumentNullException.ThrowIfNull(destinationEncoding);
|
||||||
#else
|
#else
|
||||||
if (value is null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(value));
|
throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(sourceEncoding);
|
|
||||||
#else
|
|
||||||
if (sourceEncoding is null)
|
if (sourceEncoding is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(sourceEncoding));
|
throw new ArgumentNullException(nameof(sourceEncoding));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(destinationEncoding);
|
|
||||||
#else
|
|
||||||
if (destinationEncoding is null)
|
if (destinationEncoding is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(destinationEncoding));
|
throw new ArgumentNullException(nameof(destinationEncoding));
|
||||||
@ -478,15 +474,13 @@ public static class StringExtensions
|
|||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(value);
|
ArgumentNullException.ThrowIfNull(value);
|
||||||
|
ArgumentNullException.ThrowIfNull(encoding);
|
||||||
#else
|
#else
|
||||||
if (value is null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(value));
|
throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
ArgumentNullException.ThrowIfNull(encoding);
|
|
||||||
#else
|
|
||||||
if (encoding is null)
|
if (encoding is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(encoding));
|
throw new ArgumentNullException(nameof(encoding));
|
||||||
|
Loading…
Reference in New Issue
Block a user