diff --git a/X10D.DSharpPlus/src/DiscordChannelExtensions.cs b/X10D.DSharpPlus/src/DiscordChannelExtensions.cs
index 2734af9..820ced0 100644
--- a/X10D.DSharpPlus/src/DiscordChannelExtensions.cs
+++ b/X10D.DSharpPlus/src/DiscordChannelExtensions.cs
@@ -19,14 +19,10 @@ public static class DiscordChannelExtensions
/// is .
public static DiscordChannel? GetCategory(this DiscordChannel channel)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(channel);
-#else
if (channel is null)
{
throw new ArgumentNullException(nameof(channel));
}
-#endif
while (true)
{
@@ -60,10 +56,6 @@ public static class DiscordChannelExtensions
///
public static async Task NormalizeClientAsync(this DiscordChannel channel, DiscordClient client)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(channel);
- ArgumentNullException.ThrowIfNull(client);
-#else
if (channel is null)
{
throw new ArgumentNullException(nameof(channel));
@@ -73,7 +65,6 @@ public static class DiscordChannelExtensions
{
throw new ArgumentNullException(nameof(client));
}
-#endif
return await client.GetChannelAsync(channel.Id).ConfigureAwait(false);
}
diff --git a/X10D.DSharpPlus/src/DiscordClientExtensions.cs b/X10D.DSharpPlus/src/DiscordClientExtensions.cs
index f3d8964..5dfd415 100644
--- a/X10D.DSharpPlus/src/DiscordClientExtensions.cs
+++ b/X10D.DSharpPlus/src/DiscordClientExtensions.cs
@@ -20,14 +20,10 @@ public static class DiscordClientExtensions
/// is .
public static void AutoJoinThreads(this DiscordClient client, bool rejoinIfRemoved = true)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(client);
-#else
if (client is null)
{
throw new ArgumentNullException(nameof(client));
}
-#endif
client.GuildAvailable += (_, args) => args.Guild.JoinAllThreadsAsync();
client.ThreadCreated += (_, args) => args.Thread.JoinThreadAsync();
@@ -53,14 +49,10 @@ public static class DiscordClientExtensions
/// is .
public static async Task GetUserOrNullAsync(this DiscordClient client, ulong userId)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(client);
-#else
if (client is null)
{
throw new ArgumentNullException(nameof(client));
}
-#endif
try
{
diff --git a/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs b/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs
index 4a23a34..1c2c479 100644
--- a/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs
+++ b/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs
@@ -23,14 +23,10 @@ public static class DiscordEmbedBuilderExtensions
T? value,
bool inline = false)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(builder);
-#else
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
-#endif
return builder.AddField(name, value?.ToString(), inline);
}
@@ -53,14 +49,10 @@ public static class DiscordEmbedBuilderExtensions
T? value,
bool inline = false)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(builder);
-#else
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
-#endif
if (condition)
{
@@ -92,10 +84,6 @@ public static class DiscordEmbedBuilderExtensions
T? value,
bool inline = false)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(builder);
- ArgumentNullException.ThrowIfNull(predicate);
-#else
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
@@ -105,7 +93,6 @@ public static class DiscordEmbedBuilderExtensions
{
throw new ArgumentNullException(nameof(predicate));
}
-#endif
if (predicate.Invoke())
{
@@ -139,11 +126,6 @@ public static class DiscordEmbedBuilderExtensions
Func valueFactory,
bool inline = false)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(builder);
- ArgumentNullException.ThrowIfNull(predicate);
- ArgumentNullException.ThrowIfNull(valueFactory);
-#else
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
@@ -158,7 +140,6 @@ public static class DiscordEmbedBuilderExtensions
{
throw new ArgumentNullException(nameof(valueFactory));
}
-#endif
if (predicate.Invoke())
{
@@ -190,19 +171,15 @@ public static class DiscordEmbedBuilderExtensions
Func valueFactory,
bool inline = false)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(builder);
- ArgumentNullException.ThrowIfNull(valueFactory);
-#else
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
+
if (valueFactory is null)
{
throw new ArgumentNullException(nameof(valueFactory));
}
-#endif
if (condition)
{
@@ -220,19 +197,15 @@ public static class DiscordEmbedBuilderExtensions
/// The current instance of .
public static DiscordEmbedBuilder WithAuthor(this DiscordEmbedBuilder builder, DiscordUser user)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(builder);
- ArgumentNullException.ThrowIfNull(user);
-#else
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
+
if (user is null)
{
throw new ArgumentNullException(nameof(user));
}
-#endif
return builder.WithAuthor(user.GetUsernameWithDiscriminator(), iconUrl: user.AvatarUrl);
}
diff --git a/X10D.DSharpPlus/src/DiscordGuildExtensions.cs b/X10D.DSharpPlus/src/DiscordGuildExtensions.cs
index c03016b..ff4636e 100644
--- a/X10D.DSharpPlus/src/DiscordGuildExtensions.cs
+++ b/X10D.DSharpPlus/src/DiscordGuildExtensions.cs
@@ -16,14 +16,10 @@ public static class DiscordGuildExtensions
/// is .
public static async Task JoinAllThreadsAsync(this DiscordGuild guild)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(guild);
-#else
if (guild is null)
{
throw new ArgumentNullException(nameof(guild));
}
-#endif
await Task.WhenAll(guild.Threads.Values.Select(t => t.JoinThreadAsync())).ConfigureAwait(false);
}
@@ -37,14 +33,10 @@ public static class DiscordGuildExtensions
/// is .
public static async Task GetMemberOrNullAsync(this DiscordGuild guild, ulong userId)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(guild);
-#else
if (guild is null)
{
throw new ArgumentNullException(nameof(guild));
}
-#endif
try
{
@@ -77,10 +69,6 @@ public static class DiscordGuildExtensions
///
public static async Task NormalizeClientAsync(this DiscordGuild guild, DiscordClient client)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(guild);
- ArgumentNullException.ThrowIfNull(client);
-#else
if (guild is null)
{
throw new ArgumentNullException(nameof(guild));
@@ -90,7 +78,6 @@ public static class DiscordGuildExtensions
{
throw new ArgumentNullException(nameof(client));
}
-#endif
return await client.GetGuildAsync(guild.Id).ConfigureAwait(false);
}
diff --git a/X10D.DSharpPlus/src/DiscordMemberExtensions.cs b/X10D.DSharpPlus/src/DiscordMemberExtensions.cs
index 3fd2020..7ec9925 100644
--- a/X10D.DSharpPlus/src/DiscordMemberExtensions.cs
+++ b/X10D.DSharpPlus/src/DiscordMemberExtensions.cs
@@ -18,10 +18,6 @@ public static class DiscordMemberExtensions
///
public static bool HasRole(this DiscordMember member, DiscordRole role)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(member);
- ArgumentNullException.ThrowIfNull(role);
-#else
if (member is null)
{
throw new ArgumentNullException(nameof(member));
@@ -31,7 +27,6 @@ public static class DiscordMemberExtensions
{
throw new ArgumentNullException(nameof(role));
}
-#endif
return member.Roles.Contains(role);
}
@@ -52,10 +47,6 @@ public static class DiscordMemberExtensions
///
public static async Task NormalizeClientAsync(this DiscordMember member, DiscordClient client)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(member);
- ArgumentNullException.ThrowIfNull(client);
-#else
if (member is null)
{
throw new ArgumentNullException(nameof(member));
@@ -65,7 +56,6 @@ public static class DiscordMemberExtensions
{
throw new ArgumentNullException(nameof(client));
}
-#endif
DiscordGuild guild = await member.Guild.NormalizeClientAsync(client).ConfigureAwait(false);
return await guild.GetMemberAsync(member.Id).ConfigureAwait(false);
diff --git a/X10D.DSharpPlus/src/DiscordMessageExtensions.cs b/X10D.DSharpPlus/src/DiscordMessageExtensions.cs
index f8317c7..f43116d 100644
--- a/X10D.DSharpPlus/src/DiscordMessageExtensions.cs
+++ b/X10D.DSharpPlus/src/DiscordMessageExtensions.cs
@@ -17,14 +17,10 @@ public static class DiscordMessageExtensions
/// is .
public static async Task DeleteAfterAsync(this DiscordMessage message, TimeSpan delay, string? reason = null)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(message);
-#else
if (message is null)
{
throw new ArgumentNullException(nameof(message));
}
-#endif
await Task.Delay(delay).ConfigureAwait(false);
await message.DeleteAsync(reason).ConfigureAwait(false);
@@ -39,14 +35,10 @@ public static class DiscordMessageExtensions
/// is .
public static async Task DeleteAfterAsync(this Task task, TimeSpan delay, string? reason = null)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(task);
-#else
if (task is null)
{
throw new ArgumentNullException(nameof(task));
}
-#endif
DiscordMessage message = await task.ConfigureAwait(false);
await message.DeleteAfterAsync(delay, reason).ConfigureAwait(false);
@@ -68,10 +60,6 @@ public static class DiscordMessageExtensions
///
public static async Task NormalizeClientAsync(this DiscordMessage message, DiscordClient client)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(message);
- ArgumentNullException.ThrowIfNull(client);
-#else
if (message is null)
{
throw new ArgumentNullException(nameof(message));
@@ -81,7 +69,6 @@ public static class DiscordMessageExtensions
{
throw new ArgumentNullException(nameof(client));
}
-#endif
DiscordChannel channel = await message.Channel.NormalizeClientAsync(client).ConfigureAwait(false);
return await channel.GetMessageAsync(message.Id).ConfigureAwait(false);
diff --git a/X10D.DSharpPlus/src/DiscordUserExtensions.cs b/X10D.DSharpPlus/src/DiscordUserExtensions.cs
index 6ab8314..adfd477 100644
--- a/X10D.DSharpPlus/src/DiscordUserExtensions.cs
+++ b/X10D.DSharpPlus/src/DiscordUserExtensions.cs
@@ -25,10 +25,6 @@ public static class DiscordUserExtensions
///
public static async Task GetAsMemberOfAsync(this DiscordUser user, DiscordGuild guild)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(user);
- ArgumentNullException.ThrowIfNull(guild);
-#else
if (user is null)
{
throw new ArgumentNullException(nameof(user));
@@ -38,7 +34,6 @@ public static class DiscordUserExtensions
{
throw new ArgumentNullException(nameof(guild));
}
-#endif
if (user is DiscordMember member && member.Guild == guild)
{
@@ -68,14 +63,10 @@ public static class DiscordUserExtensions
/// is .
public static string GetUsernameWithDiscriminator(this DiscordUser user)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(user);
-#else
if (user is null)
{
throw new ArgumentNullException(nameof(user));
}
-#endif
return $"{user.Username}#{user.Discriminator}";
}
@@ -91,10 +82,6 @@ public static class DiscordUserExtensions
///
public static async Task IsInGuildAsync(this DiscordUser user, DiscordGuild guild)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(user);
- ArgumentNullException.ThrowIfNull(guild);
-#else
if (user is null)
{
throw new ArgumentNullException(nameof(user));
@@ -104,7 +91,6 @@ public static class DiscordUserExtensions
{
throw new ArgumentNullException(nameof(guild));
}
-#endif
if (guild.Members.TryGetValue(user.Id, out _))
{
@@ -138,10 +124,6 @@ public static class DiscordUserExtensions
///
public static async Task NormalizeClientAsync(this DiscordUser user, DiscordClient client)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(user);
- ArgumentNullException.ThrowIfNull(client);
-#else
if (user is null)
{
throw new ArgumentNullException(nameof(user));
@@ -151,7 +133,6 @@ public static class DiscordUserExtensions
{
throw new ArgumentNullException(nameof(client));
}
-#endif
return await client.GetUserAsync(user.Id).ConfigureAwait(false);
}
diff --git a/X10D/src/Collections/ArrayExtensions.cs b/X10D/src/Collections/ArrayExtensions.cs
index c6ed75b..7dd5863 100644
--- a/X10D/src/Collections/ArrayExtensions.cs
+++ b/X10D/src/Collections/ArrayExtensions.cs
@@ -17,14 +17,10 @@ public static class ArrayExtensions
[Pure]
public static IReadOnlyCollection AsReadOnly(this T[] array)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(array);
-#else
if (array is null)
{
throw new ArgumentNullException(nameof(array));
}
-#endif
return Array.AsReadOnly(array);
}
@@ -49,14 +45,10 @@ public static class ArrayExtensions
/// is .
public static void Clear(this T?[] array, Range range)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(array);
-#else
if (array is null)
{
throw new ArgumentNullException(nameof(array));
}
-#endif
(int offset, int length) = range.GetOffsetAndLength(array.Length);
array.Clear(offset, length);
@@ -79,14 +71,10 @@ public static class ArrayExtensions
///
public static void Clear(this T?[] array, int index, int length)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(array);
-#else
if (array is null)
{
throw new ArgumentNullException(nameof(array));
}
-#endif
if (length == 0 || array.Length == 0)
{
diff --git a/X10D/src/Collections/BoolListExtensions.cs b/X10D/src/Collections/BoolListExtensions.cs
index 347d19b..6258617 100644
--- a/X10D/src/Collections/BoolListExtensions.cs
+++ b/X10D/src/Collections/BoolListExtensions.cs
@@ -18,14 +18,10 @@ public static class BoolListExtensions
[Pure]
public static byte PackByte(this IReadOnlyList source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (source.Count > 8)
{
@@ -52,14 +48,10 @@ public static class BoolListExtensions
[Pure]
public static short PackInt16(this IReadOnlyList source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (source.Count > 16)
{
@@ -86,14 +78,10 @@ public static class BoolListExtensions
[Pure]
public static int PackInt32(this IReadOnlyList source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (source.Count > 32)
{
@@ -120,14 +108,10 @@ public static class BoolListExtensions
[Pure]
public static long PackInt64(this IReadOnlyList source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (source.Count > 64)
{
diff --git a/X10D/src/Collections/CollectionExtensions.cs b/X10D/src/Collections/CollectionExtensions.cs
index 3554586..e9b2c6e 100644
--- a/X10D/src/Collections/CollectionExtensions.cs
+++ b/X10D/src/Collections/CollectionExtensions.cs
@@ -16,14 +16,10 @@ public static class CollectionExtensions
///
public static void ClearAndDisposeAll(this ICollection source) where T : IDisposable
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (source.IsReadOnly)
{
@@ -55,14 +51,10 @@ public static class CollectionExtensions
///
public static async Task ClearAndDisposeAllAsync(this ICollection source) where T : IAsyncDisposable
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (source.IsReadOnly)
{
diff --git a/X10D/src/Collections/DictionaryExtensions.cs b/X10D/src/Collections/DictionaryExtensions.cs
index 66823b0..241efe9 100644
--- a/X10D/src/Collections/DictionaryExtensions.cs
+++ b/X10D/src/Collections/DictionaryExtensions.cs
@@ -37,10 +37,6 @@ public static class DictionaryExtensions
Func updateValueFactory)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(dictionary);
- ArgumentNullException.ThrowIfNull(updateValueFactory);
-#else
if (dictionary is null)
{
throw new ArgumentNullException(nameof(dictionary));
@@ -50,7 +46,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(updateValueFactory));
}
-#endif
#if NET6_0_OR_GREATER
ref var value = ref CollectionsMarshal.GetValueRefOrAddDefault(dictionary, key, out bool exists);
@@ -97,10 +92,6 @@ public static class DictionaryExtensions
Func updateValueFactory)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(dictionary);
- ArgumentNullException.ThrowIfNull(updateValueFactory);
-#else
if (dictionary is null)
{
throw new ArgumentNullException(nameof(dictionary));
@@ -110,7 +101,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(updateValueFactory));
}
-#endif
if (dictionary.TryGetValue(key, out TValue? old))
{
@@ -152,11 +142,6 @@ public static class DictionaryExtensions
Func addValueFactory, Func updateValueFactory)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(dictionary);
- ArgumentNullException.ThrowIfNull(addValueFactory);
- ArgumentNullException.ThrowIfNull(updateValueFactory);
-#else
if (dictionary is null)
{
throw new ArgumentNullException(nameof(dictionary));
@@ -171,7 +156,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(updateValueFactory));
}
-#endif
#if NET6_0_OR_GREATER
ref TValue? value = ref CollectionsMarshal.GetValueRefOrAddDefault(dictionary, key, out bool exists);
@@ -222,11 +206,6 @@ public static class DictionaryExtensions
Func addValueFactory, Func updateValueFactory)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(dictionary);
- ArgumentNullException.ThrowIfNull(addValueFactory);
- ArgumentNullException.ThrowIfNull(updateValueFactory);
-#else
if (dictionary is null)
{
throw new ArgumentNullException(nameof(dictionary));
@@ -241,7 +220,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(updateValueFactory));
}
-#endif
if (dictionary.TryGetValue(key, out TValue? old))
{
@@ -291,11 +269,6 @@ public static class DictionaryExtensions
Func addValueFactory, Func updateValueFactory, TArg factoryArgument)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(dictionary);
- ArgumentNullException.ThrowIfNull(addValueFactory);
- ArgumentNullException.ThrowIfNull(updateValueFactory);
-#else
if (dictionary is null)
{
throw new ArgumentNullException(nameof(dictionary));
@@ -310,7 +283,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(updateValueFactory));
}
-#endif
#if NET6_0_OR_GREATER
ref TValue? value = ref CollectionsMarshal.GetValueRefOrAddDefault(dictionary, key, out bool exists);
@@ -367,11 +339,6 @@ public static class DictionaryExtensions
Func addValueFactory, Func updateValueFactory, TArg factoryArgument)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(dictionary);
- ArgumentNullException.ThrowIfNull(addValueFactory);
- ArgumentNullException.ThrowIfNull(updateValueFactory);
-#else
if (dictionary is null)
{
throw new ArgumentNullException(nameof(dictionary));
@@ -386,7 +353,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(updateValueFactory));
}
-#endif
if (dictionary.TryGetValue(key, out TValue? old))
{
@@ -414,14 +380,10 @@ public static class DictionaryExtensions
[Pure]
public static string ToConnectionString(this IEnumerable> source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
static string SanitizeValue(string? value)
{
@@ -461,10 +423,6 @@ public static class DictionaryExtensions
public static string ToConnectionString(this IEnumerable> source,
Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(selector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -474,7 +432,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(selector));
}
-#endif
static string SanitizeValue(string? value)
{
@@ -520,11 +477,6 @@ public static class DictionaryExtensions
Func keySelector, Func valueSelector)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(keySelector);
- ArgumentNullException.ThrowIfNull(valueSelector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -539,7 +491,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(valueSelector));
}
-#endif
static string SanitizeValue(string? value)
{
@@ -571,14 +522,10 @@ public static class DictionaryExtensions
public static string ToGetParameters(this IEnumerable> source)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
static string GetQueryParameter(KeyValuePair pair)
{
@@ -610,10 +557,6 @@ public static class DictionaryExtensions
Func selector)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(selector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -623,7 +566,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(selector));
}
-#endif
// can't static here because of 'selector' parameter
string GetQueryParameter(KeyValuePair pair)
@@ -661,11 +603,6 @@ public static class DictionaryExtensions
Func keySelector, Func valueSelector)
where TKey : notnull
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(keySelector);
- ArgumentNullException.ThrowIfNull(valueSelector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -680,7 +617,6 @@ public static class DictionaryExtensions
{
throw new ArgumentNullException(nameof(valueSelector));
}
-#endif
// can't static here because of selector parameters
string GetQueryParameter(KeyValuePair pair)
diff --git a/X10D/src/Collections/EnumerableExtensions.cs b/X10D/src/Collections/EnumerableExtensions.cs
index c38e4df..a183c2b 100644
--- a/X10D/src/Collections/EnumerableExtensions.cs
+++ b/X10D/src/Collections/EnumerableExtensions.cs
@@ -24,10 +24,6 @@ public static class EnumerableExtensions
[Pure]
public static int CountWhereNot(this IEnumerable source, Func predicate)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(predicate);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -37,7 +33,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(predicate));
}
-#endif
return source.Count(item => !predicate(item));
}
@@ -58,10 +53,6 @@ public static class EnumerableExtensions
[Pure]
public static TSource FirstWhereNot(this IEnumerable source, Func predicate)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(predicate);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -71,7 +62,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(predicate));
}
-#endif
return source.First(item => !predicate(item));
}
@@ -91,10 +81,6 @@ public static class EnumerableExtensions
[Pure]
public static TSource? FirstWhereNotOrDefault(this IEnumerable source, Func predicate)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(predicate);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -104,7 +90,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(predicate));
}
-#endif
return source.FirstOrDefault(item => !predicate(item));
}
@@ -127,10 +112,6 @@ public static class EnumerableExtensions
///
public static void For(this IEnumerable source, Action action)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(action);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -140,7 +121,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(action));
}
-#endif
var index = 0;
foreach (T item in source)
@@ -166,10 +146,6 @@ public static class EnumerableExtensions
///
public static void ForEach(this IEnumerable source, Action action)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(action);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -179,7 +155,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(action));
}
-#endif
foreach (T item in source)
{
@@ -196,14 +171,10 @@ public static class EnumerableExtensions
///
public static void DisposeAll(this IEnumerable source) where T : IDisposable
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
foreach (T item in source)
{
@@ -227,14 +198,10 @@ public static class EnumerableExtensions
///
public static async Task DisposeAllAsync(this IEnumerable source) where T : IAsyncDisposable
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
foreach (T item in source)
{
@@ -264,10 +231,6 @@ public static class EnumerableExtensions
[Pure]
public static TSource LastWhereNot(this IEnumerable source, Func predicate)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(predicate);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -277,7 +240,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(predicate));
}
-#endif
return source.Last(item => !predicate(item));
}
@@ -297,10 +259,6 @@ public static class EnumerableExtensions
[Pure]
public static TSource? LastWhereNotOrDefault(this IEnumerable source, Func predicate)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(predicate);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -310,7 +268,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(predicate));
}
-#endif
return source.LastOrDefault(item => !predicate(item));
}
@@ -326,14 +283,10 @@ public static class EnumerableExtensions
[Pure]
public static IReadOnlyCollection Shuffled(this IEnumerable source, Random? random = null)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
var list = new List(source);
list.Shuffle(random);
@@ -355,10 +308,6 @@ public static class EnumerableExtensions
[Pure]
public static IEnumerable WhereNot(this IEnumerable source, Func predicate)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(predicate);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -368,7 +317,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(predicate));
}
-#endif
return source.Where(item => !predicate(item));
}
@@ -386,14 +334,10 @@ public static class EnumerableExtensions
/// is .
public static IEnumerable WhereNotNull(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Where(item => item is not null).Select(item => item!);
}
diff --git a/X10D/src/Collections/ListExtensions.cs b/X10D/src/Collections/ListExtensions.cs
index 69292b4..be53ee8 100644
--- a/X10D/src/Collections/ListExtensions.cs
+++ b/X10D/src/Collections/ListExtensions.cs
@@ -19,14 +19,10 @@ public static class ListExtensions
/// is .
public static void Fill(this IList source, T value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
for (var i = 0; i < source.Count; i++)
{
@@ -53,14 +49,10 @@ public static class ListExtensions
///
public static void Fill(this IList source, T value, int startIndex, int count)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (startIndex < 0)
{
@@ -105,14 +97,10 @@ public static class ListExtensions
/// is .
public static int IndexOf(this IReadOnlyList source, T? item)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.IndexOf(item, 0, source.Count);
}
@@ -138,14 +126,10 @@ public static class ListExtensions
///
public static int IndexOf(this IReadOnlyList source, T? item, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.IndexOf(item, startIndex, source.Count - startIndex);
}
@@ -182,14 +166,10 @@ public static class ListExtensions
///
public static int IndexOf(this IReadOnlyList source, T? item, int startIndex, int count)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (startIndex < 0 || startIndex > source.Count)
{
@@ -233,14 +213,10 @@ public static class ListExtensions
[Pure]
public static T Random(this IReadOnlyList source, Random? random = null)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
random ??= RandomExtensions.GetShared();
return random.NextFrom(source);
@@ -260,14 +236,10 @@ public static class ListExtensions
///
public static void RemoveRange(this IList source, Range range)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
int start = range.Start.IsFromEnd ? source.Count - range.Start.Value : range.Start.Value;
int end = range.End.IsFromEnd ? source.Count - range.End.Value : range.End.Value;
@@ -300,14 +272,10 @@ public static class ListExtensions
/// is .
public static void Shuffle(this IList source, Random? random = null)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
random ??= RandomExtensions.GetShared();
@@ -334,14 +302,10 @@ public static class ListExtensions
///
public static IReadOnlyList Slice(this IReadOnlyList source, int start)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Slice(start, source.Count - start);
}
@@ -363,14 +327,10 @@ public static class ListExtensions
///
public static IReadOnlyList Slice(this IReadOnlyList source, int start, int length)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (start < 0 || start > source.Count)
{
@@ -406,10 +366,6 @@ public static class ListExtensions
///
public static void Swap(this IList source, IList other)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(other);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -419,7 +375,6 @@ public static class ListExtensions
{
throw new ArgumentNullException(nameof(other));
}
-#endif
int min = System.Math.Min(source.Count, other.Count);
for (var index = 0; index < min; index++)
diff --git a/X10D/src/Core/RandomExtensions.cs b/X10D/src/Core/RandomExtensions.cs
index 32acc3b..49e8634 100644
--- a/X10D/src/Core/RandomExtensions.cs
+++ b/X10D/src/Core/RandomExtensions.cs
@@ -27,14 +27,10 @@ public static class RandomExtensions
public static T Next(this Random random)
where T : struct, Enum
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
var values = Enum.GetValues(typeof(T));
return (T)values.GetValue(random.Next(values.Length))!;
@@ -54,14 +50,10 @@ public static class RandomExtensions
/// is .
public static bool NextBoolean(this Random random)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return random.NextDouble() >= 0.5;
}
@@ -81,14 +73,10 @@ public static class RandomExtensions
/// is less than 0.
public static double NextDouble(this Random random, double maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
if (maxValue < 0)
{
@@ -117,14 +105,10 @@ public static class RandomExtensions
///
public static double NextDouble(this Random random, double minValue, double maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
if (maxValue < minValue)
{
@@ -155,10 +139,6 @@ public static class RandomExtensions
///
public static T NextFrom(this Random random, IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
- ArgumentNullException.ThrowIfNull(source);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
@@ -168,7 +148,6 @@ public static class RandomExtensions
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (source is T[] array)
{
@@ -206,14 +185,10 @@ public static class RandomExtensions
///
public static T NextFrom(this Random random, Span source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return source[random.Next(source.Length)];
}
@@ -242,14 +217,10 @@ public static class RandomExtensions
///
public static T NextFrom(this Random random, ReadOnlySpan source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return source[random.Next(source.Length)];
}
@@ -264,14 +235,10 @@ public static class RandomExtensions
/// is .
public static byte NextByte(this Random random)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return random.NextByte(byte.MaxValue);
}
@@ -292,14 +259,10 @@ public static class RandomExtensions
/// is .
public static byte NextByte(this Random random, byte maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return random.NextByte(0, maxValue);
}
@@ -325,14 +288,10 @@ public static class RandomExtensions
///
public static byte NextByte(this Random random, byte minValue, byte maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return (byte)random.Next(minValue, maxValue);
}
@@ -347,14 +306,10 @@ public static class RandomExtensions
/// is .
public static short NextInt16(this Random random)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return random.NextInt16(short.MaxValue);
}
@@ -376,14 +331,10 @@ public static class RandomExtensions
/// is less than 0.
public static short NextInt16(this Random random, short maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
if (maxValue < 0)
{
@@ -414,14 +365,10 @@ public static class RandomExtensions
/// is .
public static short NextInt16(this Random random, short minValue, short maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
return (short)random.Next(minValue, maxValue);
}
@@ -459,14 +406,10 @@ public static class RandomExtensions
/// is less than 0.
public static float NextSingle(this Random random, float maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
if (maxValue < 0)
{
@@ -495,14 +438,10 @@ public static class RandomExtensions
///
public static float NextSingle(this Random random, float minValue, float maxValue)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
if (maxValue < minValue)
{
@@ -530,10 +469,6 @@ public static class RandomExtensions
/// is less than 0.
public static string NextString(this Random random, IReadOnlyList source, int length)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
- ArgumentNullException.ThrowIfNull(source);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
@@ -543,7 +478,6 @@ public static class RandomExtensions
{
throw new ArgumentNullException(nameof(source));
}
-#endif
if (length < 0)
{
diff --git a/X10D/src/Drawing/Polygon.cs b/X10D/src/Drawing/Polygon.cs
index 63abae8..9f03b58 100644
--- a/X10D/src/Drawing/Polygon.cs
+++ b/X10D/src/Drawing/Polygon.cs
@@ -22,14 +22,10 @@ public class Polygon : IEquatable
///
public Polygon(Polygon polygon)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(polygon);
-#else
if (polygon is null)
{
throw new ArgumentNullException(nameof(polygon));
}
-#endif
_vertices = new List();
for (var index = 0; index < polygon._vertices.Count; index++)
@@ -45,14 +41,10 @@ public class Polygon : IEquatable
/// An enumerable collection of vertices from which the polygon should be constructed.
public Polygon(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
_vertices = new List(vertices);
}
@@ -176,14 +168,10 @@ public class Polygon : IEquatable
/// is .
public static Polygon FromPolygonF(PolygonF polygon)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(polygon);
-#else
if (polygon is null)
{
throw new ArgumentNullException(nameof(polygon));
}
-#endif
var vertices = new List();
@@ -211,14 +199,10 @@ public class Polygon : IEquatable
/// is .
public void AddVertices(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
foreach (Point vertex in vertices)
{
diff --git a/X10D/src/Drawing/PolygonF.cs b/X10D/src/Drawing/PolygonF.cs
index 51d9eeb..074edc3 100644
--- a/X10D/src/Drawing/PolygonF.cs
+++ b/X10D/src/Drawing/PolygonF.cs
@@ -25,14 +25,10 @@ public class PolygonF
/// is .
public PolygonF(PolygonF polygon)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(polygon);
-#else
if (polygon is null)
{
throw new ArgumentNullException(nameof(polygon));
}
-#endif
_vertices = new List();
for (var index = 0; index < polygon._vertices.Count; index++)
{
@@ -48,14 +44,10 @@ public class PolygonF
/// is .
public PolygonF(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
_vertices = new List();
foreach (Vector2 vertex in vertices)
@@ -71,14 +63,10 @@ public class PolygonF
/// is .
public PolygonF(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
_vertices = new List(vertices);
}
@@ -202,14 +190,10 @@ public class PolygonF
/// is .
public static PolygonF FromPolygon(Polygon polygon)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(polygon);
-#else
if (polygon is null)
{
throw new ArgumentNullException(nameof(polygon));
}
-#endif
var vertices = new List();
@@ -246,14 +230,10 @@ public class PolygonF
/// is .
public void AddVertices(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
foreach (PointF vertex in vertices)
{
@@ -268,14 +248,10 @@ public class PolygonF
/// is .
public void AddVertices(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
foreach (Vector2 vertex in vertices)
{
diff --git a/X10D/src/Drawing/Polyhedron.cs b/X10D/src/Drawing/Polyhedron.cs
index 2f46ca0..6be327e 100644
--- a/X10D/src/Drawing/Polyhedron.cs
+++ b/X10D/src/Drawing/Polyhedron.cs
@@ -34,14 +34,10 @@ public class Polyhedron : IEquatable
/// is .
public Polyhedron(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
_vertices = new List(vertices);
}
@@ -137,14 +133,10 @@ public class Polyhedron : IEquatable
/// is .
public static Polyhedron FromPolygon(Polygon polygon)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(polygon);
-#else
if (polygon is null)
{
throw new ArgumentNullException(nameof(polygon));
}
-#endif
var vertices = new List();
@@ -164,14 +156,10 @@ public class Polyhedron : IEquatable
/// is .
public static Polyhedron FromPolygonF(PolygonF polygon)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(polygon);
-#else
if (polygon is null)
{
throw new ArgumentNullException(nameof(polygon));
}
-#endif
var vertices = new List();
@@ -199,14 +187,10 @@ public class Polyhedron : IEquatable
/// is .
public void AddVertices(IEnumerable vertices)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(vertices);
-#else
if (vertices is null)
{
throw new ArgumentNullException(nameof(vertices));
}
-#endif
foreach (Vector3 vertex in vertices)
{
diff --git a/X10D/src/Drawing/RandomExtensions.cs b/X10D/src/Drawing/RandomExtensions.cs
index 24c7419..880cd84 100644
--- a/X10D/src/Drawing/RandomExtensions.cs
+++ b/X10D/src/Drawing/RandomExtensions.cs
@@ -17,14 +17,10 @@ public static class RandomExtensions
/// is .
public static Color NextColorRgb(this Random random)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
int rgb = random.Next();
return Color.FromArgb(0xFF, (byte)(rgb >> 16 & 0xFF), (byte)(rgb >> 8 & 0xFF), (byte)(rgb & 0xFF));
@@ -38,14 +34,10 @@ public static class RandomExtensions
/// is .
public static Color NextColorArgb(this Random random)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(random);
-#else
if (random is null)
{
throw new ArgumentNullException(nameof(random));
}
-#endif
int argb = random.Next();
return Color.FromArgb(argb);
diff --git a/X10D/src/IO/DirectoryInfoExtensions.cs b/X10D/src/IO/DirectoryInfoExtensions.cs
index 5eb0a92..c6c7e81 100644
--- a/X10D/src/IO/DirectoryInfoExtensions.cs
+++ b/X10D/src/IO/DirectoryInfoExtensions.cs
@@ -33,14 +33,10 @@ public static class DirectoryInfoExtensions
/// This directory or one of its children contain a read-only file.
public static void Clear(this DirectoryInfo directory)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(directory);
-#else
if (directory is null)
{
throw new ArgumentNullException(nameof(directory));
}
-#endif
if (!directory.Exists)
{
diff --git a/X10D/src/IO/FileInfoExtensions.cs b/X10D/src/IO/FileInfoExtensions.cs
index a0878bc..e1a4e69 100644
--- a/X10D/src/IO/FileInfoExtensions.cs
+++ b/X10D/src/IO/FileInfoExtensions.cs
@@ -29,14 +29,10 @@ public static class FileInfoExtensions
public static byte[] GetHash(this FileInfo value)
where T : HashAlgorithm
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(value);
-#else
if (value is null)
{
throw new ArgumentNullException(nameof(value));
}
-#endif
using FileStream stream = value.OpenRead();
return stream.GetHash();
@@ -69,14 +65,10 @@ public static class FileInfoExtensions
public static bool TryWriteHash(this FileInfo value, Span destination, out int bytesWritten)
where T : HashAlgorithm
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(value);
-#else
if (value is null)
{
throw new ArgumentNullException(nameof(value));
}
-#endif
using FileStream stream = value.OpenRead();
return stream.TryWriteHash(destination, out bytesWritten);
diff --git a/X10D/src/IO/ListOfByteExtensions.cs b/X10D/src/IO/ListOfByteExtensions.cs
index 3289fef..5d9122f 100644
--- a/X10D/src/IO/ListOfByteExtensions.cs
+++ b/X10D/src/IO/ListOfByteExtensions.cs
@@ -19,14 +19,10 @@ public static class ListOfByteExtensions
/// is .
public static string AsString(this IReadOnlyList source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToString(source.ToArray());
}
@@ -54,14 +50,10 @@ public static class ListOfByteExtensions
/// is .
public static double ToDouble(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToDouble(source.ToArray(), startIndex);
}
@@ -86,14 +78,10 @@ public static class ListOfByteExtensions
/// is .
public static short ToInt16(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToInt16(source.ToArray(), startIndex);
}
@@ -118,14 +106,10 @@ public static class ListOfByteExtensions
/// is .
public static int ToInt32(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToInt32(source.ToArray(), startIndex);
}
@@ -150,14 +134,10 @@ public static class ListOfByteExtensions
/// is .
public static long ToInt64(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToInt64(source.ToArray(), startIndex);
}
@@ -183,14 +163,10 @@ public static class ListOfByteExtensions
/// is .
public static float ToSingle(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToSingle(source.ToArray(), startIndex);
}
@@ -208,10 +184,6 @@ public static class ListOfByteExtensions
///
public static string ToString(this IReadOnlyList source, Encoding encoding)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(encoding);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -221,7 +193,6 @@ public static class ListOfByteExtensions
{
throw new ArgumentNullException(nameof(encoding));
}
-#endif
return encoding.GetString(source.ToArray());
}
@@ -248,14 +219,10 @@ public static class ListOfByteExtensions
[CLSCompliant(false)]
public static ushort ToUInt16(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToUInt16(source.ToArray(), startIndex);
}
@@ -282,14 +249,10 @@ public static class ListOfByteExtensions
[CLSCompliant(false)]
public static uint ToUInt32(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToUInt32(source.ToArray(), startIndex);
}
@@ -316,14 +279,10 @@ public static class ListOfByteExtensions
[CLSCompliant(false)]
public static ulong ToUInt64(this IReadOnlyList source, int startIndex)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return BitConverter.ToUInt64(source.ToArray(), startIndex);
}
diff --git a/X10D/src/IO/StreamExtensions.cs b/X10D/src/IO/StreamExtensions.cs
index c55b784..d1d44db 100644
--- a/X10D/src/IO/StreamExtensions.cs
+++ b/X10D/src/IO/StreamExtensions.cs
@@ -33,14 +33,10 @@ public static class StreamExtensions
public static byte[] GetHash(this Stream stream)
where T : HashAlgorithm
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
if (!stream.CanRead)
{
@@ -87,14 +83,10 @@ public static class StreamExtensions
/// A decimal value read from the stream.
public static decimal ReadDecimal(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -151,14 +143,10 @@ public static class StreamExtensions
/// A double-precision floating point value read from the stream.
public static double ReadDouble(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -211,14 +199,10 @@ public static class StreamExtensions
/// An two-byte unsigned integer read from the stream.
public static short ReadInt16(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -265,14 +249,10 @@ public static class StreamExtensions
/// An four-byte unsigned integer read from the stream.
public static int ReadInt32(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -319,14 +299,10 @@ public static class StreamExtensions
/// An eight-byte unsigned integer read from the stream.
public static long ReadInt64(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -373,14 +349,10 @@ public static class StreamExtensions
/// A single-precision floating point value read from the stream.
public static float ReadSingle(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -435,14 +407,10 @@ public static class StreamExtensions
[CLSCompliant(false)]
public static ushort ReadUInt16(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -491,14 +459,10 @@ public static class StreamExtensions
[CLSCompliant(false)]
public static uint ReadUInt32(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -547,14 +511,10 @@ public static class StreamExtensions
[CLSCompliant(false)]
public static ulong ReadUInt64(this Stream stream, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -607,14 +567,10 @@ public static class StreamExtensions
public static bool TryWriteHash(this Stream stream, Span destination, out int bytesWritten)
where T : HashAlgorithm
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
if (!stream.CanRead)
{
@@ -671,14 +627,10 @@ public static class StreamExtensions
/// The number of bytes written to the stream.
public static int Write(this Stream stream, short value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -735,14 +687,10 @@ public static class StreamExtensions
/// is .
public static int Write(this Stream stream, int value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -800,14 +748,10 @@ public static class StreamExtensions
/// is .
public static int Write(this Stream stream, long value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -867,14 +811,10 @@ public static class StreamExtensions
[CLSCompliant(false)]
public static int Write(this Stream stream, ushort value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -934,14 +874,10 @@ public static class StreamExtensions
[CLSCompliant(false)]
public static int Write(this Stream stream, uint value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -1001,14 +937,10 @@ public static class StreamExtensions
[CLSCompliant(false)]
public static int Write(this Stream stream, ulong value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -1052,14 +984,10 @@ public static class StreamExtensions
/// is .
public static int Write(this Stream stream, float value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -1135,14 +1063,10 @@ public static class StreamExtensions
/// is .
public static int Write(this Stream stream, double value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
@@ -1219,14 +1143,10 @@ public static class StreamExtensions
[ExcludeFromCodeCoverage]
public static int Write(this Stream stream, decimal value, Endianness endianness)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(stream);
-#else
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
-#endif
#if NET5_0_OR_GREATER
if (!Enum.IsDefined(endianness))
diff --git a/X10D/src/IO/TextReaderExtensions.cs b/X10D/src/IO/TextReaderExtensions.cs
index 4ecb213..b8bef35 100644
--- a/X10D/src/IO/TextReaderExtensions.cs
+++ b/X10D/src/IO/TextReaderExtensions.cs
@@ -13,14 +13,10 @@ public static class TextReaderExtensions
/// is .
public static IEnumerable EnumerateLines(this TextReader reader)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(reader);
-#else
if (reader is null)
{
throw new ArgumentNullException(nameof(reader));
}
-#endif
while (reader.ReadLine() is { } line)
{
@@ -36,14 +32,10 @@ public static class TextReaderExtensions
/// is .
public static async IAsyncEnumerable EnumerateLinesAsync(this TextReader reader)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(reader);
-#else
if (reader is null)
{
throw new ArgumentNullException(nameof(reader));
}
-#endif
while (await reader.ReadLineAsync().ConfigureAwait(false) is { } line)
{
diff --git a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Double.cs b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Double.cs
index 1a63f42..1317846 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Double.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Double.cs
@@ -16,14 +16,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, double value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -41,14 +37,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, double value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteLineNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -68,14 +60,10 @@ public static partial class TextWriterExtensions
public static void WriteLineNoAlloc(this TextWriter writer, double value, ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteNoAlloc(value, format, formatProvider);
writer.WriteLine();
diff --git a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int32.cs b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int32.cs
index 8836d63..9640a6a 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int32.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int32.cs
@@ -16,14 +16,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, int value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -41,14 +37,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, int value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteLineNoAlloc(writer, (long)value, format, CultureInfo.CurrentCulture);
}
@@ -68,14 +60,10 @@ public static partial class TextWriterExtensions
public static void WriteLineNoAlloc(this TextWriter writer, int value, ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteNoAlloc(value, format, formatProvider);
writer.WriteLine();
diff --git a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int64.cs b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int64.cs
index 83deadd..8ca5855 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int64.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Int64.cs
@@ -16,14 +16,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, long value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -41,14 +37,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, long value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, format, CultureInfo.CurrentCulture);
}
@@ -70,14 +62,10 @@ public static partial class TextWriterExtensions
ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteNoAlloc(value, format, formatProvider);
writer.WriteLine();
diff --git a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Single.cs b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Single.cs
index bb6d2e0..9194c62 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Single.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.Single.cs
@@ -16,14 +16,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, float value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -41,14 +37,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteLineNoAlloc(this TextWriter writer, float value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteLineNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -68,14 +60,10 @@ public static partial class TextWriterExtensions
public static void WriteLineNoAlloc(this TextWriter writer, float value, ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteNoAlloc(value, format, formatProvider);
writer.WriteLine();
diff --git a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt32.cs b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt32.cs
index 98e9d42..b812afb 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt32.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt32.cs
@@ -17,14 +17,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteLineNoAlloc(this TextWriter writer, uint value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -43,14 +39,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteLineNoAlloc(this TextWriter writer, uint value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteLineNoAlloc(writer, (long)value, format, CultureInfo.CurrentCulture);
}
@@ -73,14 +65,10 @@ public static partial class TextWriterExtensions
ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteNoAlloc(value, format, formatProvider);
writer.WriteLine();
diff --git a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt64.cs b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt64.cs
index 68f397f..7b55571 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt64.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteLineNoAlloc.UInt64.cs
@@ -17,14 +17,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteLineNoAlloc(this TextWriter writer, ulong value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -43,14 +39,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteLineNoAlloc(this TextWriter writer, ulong value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteLineNoAlloc(value, format, CultureInfo.CurrentCulture);
}
@@ -73,14 +65,10 @@ public static partial class TextWriterExtensions
ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
writer.WriteNoAlloc(value, format, formatProvider);
writer.WriteLine();
diff --git a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Double.cs b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Double.cs
index 6b6de18..a8d5bbb 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Double.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Double.cs
@@ -15,14 +15,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, double value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -39,14 +35,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, double value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -65,14 +57,10 @@ public static partial class TextWriterExtensions
public static void WriteNoAlloc(this TextWriter writer, double value, ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
Span buffer = stackalloc char[100];
if (value.TryFormat(buffer, out int charsWritten, format, formatProvider))
diff --git a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int32.cs b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int32.cs
index c2366bf..2018363 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int32.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int32.cs
@@ -16,14 +16,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, int value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -40,14 +36,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, int value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -65,14 +57,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, int value, ReadOnlySpan format, IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
int digitCount = value.CountDigits();
Span buffer = stackalloc char[System.Math.Max(value < 0 ? digitCount + 1 : digitCount, 100)];
diff --git a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int64.cs b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int64.cs
index 049d891..c0cb32f 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int64.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Int64.cs
@@ -16,14 +16,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, long value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -40,14 +36,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, long value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -68,14 +60,10 @@ public static partial class TextWriterExtensions
ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
int digitCount = value.CountDigits();
Span buffer = stackalloc char[System.Math.Max(value < 0 ? digitCount + 1 : digitCount, 100)];
diff --git a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Single.cs b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Single.cs
index f595593..b48a415 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Single.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.Single.cs
@@ -15,14 +15,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, float value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -39,14 +35,10 @@ public static partial class TextWriterExtensions
/// An I/O error occurs.
public static void WriteNoAlloc(this TextWriter writer, float value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -65,14 +57,10 @@ public static partial class TextWriterExtensions
public static void WriteNoAlloc(this TextWriter writer, float value, ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
Span buffer = stackalloc char[100];
if (value.TryFormat(buffer, out int charsWritten, format, formatProvider))
diff --git a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt32.cs b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt32.cs
index f8d32a2..b38fa0a 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt32.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt32.cs
@@ -17,14 +17,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteNoAlloc(this TextWriter writer, uint value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -42,14 +38,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteNoAlloc(this TextWriter writer, uint value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -71,14 +63,10 @@ public static partial class TextWriterExtensions
ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
int digitCount = value.CountDigits();
Span buffer = stackalloc char[System.Math.Max(digitCount, 100)];
diff --git a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt64.cs b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt64.cs
index 5e266e4..d9a48f4 100644
--- a/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt64.cs
+++ b/X10D/src/IO/TextWriterExtensions.WriteNoAlloc.UInt64.cs
@@ -17,14 +17,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteNoAlloc(this TextWriter writer, ulong value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, "N0".AsSpan(), CultureInfo.CurrentCulture);
}
@@ -42,14 +38,10 @@ public static partial class TextWriterExtensions
[CLSCompliant(false)]
public static void WriteNoAlloc(this TextWriter writer, ulong value, ReadOnlySpan format)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
WriteNoAlloc(writer, value, format, CultureInfo.CurrentCulture);
}
@@ -71,14 +63,10 @@ public static partial class TextWriterExtensions
ReadOnlySpan format,
IFormatProvider? formatProvider)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(writer);
-#else
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
-#endif
int digitCount = value.CountDigits();
Span buffer = stackalloc char[System.Math.Max(digitCount, 100)];
diff --git a/X10D/src/Linq/ByteExtensions.cs b/X10D/src/Linq/ByteExtensions.cs
index 3d7524d..64d1c01 100644
--- a/X10D/src/Linq/ByteExtensions.cs
+++ b/X10D/src/Linq/ByteExtensions.cs
@@ -15,14 +15,10 @@ public static class ByteExtensions
/// is .
public static byte Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate((byte)1, (current, value) => (byte)(current * value));
}
@@ -36,14 +32,10 @@ public static class ByteExtensions
[CLSCompliant(false)]
public static sbyte Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate((sbyte)1, (current, value) => (sbyte)(current * value));
}
@@ -59,14 +51,10 @@ public static class ByteExtensions
/// is .
public static byte Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
@@ -83,14 +71,10 @@ public static class ByteExtensions
[CLSCompliant(false)]
public static sbyte Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
diff --git a/X10D/src/Linq/DecimalExtensions.cs b/X10D/src/Linq/DecimalExtensions.cs
index 01dde51..c5e1bc7 100644
--- a/X10D/src/Linq/DecimalExtensions.cs
+++ b/X10D/src/Linq/DecimalExtensions.cs
@@ -13,14 +13,10 @@ public static class DecimalExtensions
/// is .
public static decimal Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate(1m, (current, value) => (current * value));
}
@@ -36,14 +32,10 @@ public static class DecimalExtensions
/// is .
public static decimal Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
diff --git a/X10D/src/Linq/DoubleExtensions.cs b/X10D/src/Linq/DoubleExtensions.cs
index afb38ae..23628af 100644
--- a/X10D/src/Linq/DoubleExtensions.cs
+++ b/X10D/src/Linq/DoubleExtensions.cs
@@ -13,14 +13,10 @@ public static class DoubleExtensions
/// is .
public static double Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate(1.0, (current, value) => (current * value));
}
@@ -36,14 +32,10 @@ public static class DoubleExtensions
/// is .
public static double Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
diff --git a/X10D/src/Linq/EnumerableExtensions.cs b/X10D/src/Linq/EnumerableExtensions.cs
index 92592bf..05004c9 100644
--- a/X10D/src/Linq/EnumerableExtensions.cs
+++ b/X10D/src/Linq/EnumerableExtensions.cs
@@ -22,14 +22,10 @@ public static class EnumerableExtensions
/// is .
public static IEnumerable ConcatOne(this IEnumerable source, TSource value)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
foreach (TSource item in source)
{
@@ -52,14 +48,10 @@ public static class EnumerableExtensions
/// is .
public static IEnumerable Except(this IEnumerable source, TSource item)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Where(i => !Equals(i, item));
}
@@ -74,14 +66,10 @@ public static class EnumerableExtensions
/// contains no elements.
public static (T? Minimum, T? Maximum) MinMax(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return MinMax(source, Comparer.Default);
}
@@ -97,14 +85,10 @@ public static class EnumerableExtensions
/// contains no elements.
public static (T? Minimum, T? Maximum) MinMax(this IEnumerable source, IComparer? comparer)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
comparer ??= Comparer.Default;
@@ -160,10 +144,6 @@ public static class EnumerableExtensions
public static (TResult? Minimum, TResult? Maximum) MinMax(this IEnumerable source,
Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(selector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -173,7 +153,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(selector));
}
-#endif
return MinMax(source, selector, Comparer.Default);
}
@@ -194,10 +173,6 @@ public static class EnumerableExtensions
Func selector,
IComparer? comparer)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(selector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -207,7 +182,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(selector));
}
-#endif
comparer ??= Comparer.Default;
@@ -263,10 +237,6 @@ public static class EnumerableExtensions
public static (TSource? Minimum, TSource? Maximum) MinMaxBy(this IEnumerable source,
Func keySelector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(keySelector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -276,7 +246,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(keySelector));
}
-#endif
return MinMaxBy(source, keySelector, Comparer.Default);
}
@@ -296,10 +265,6 @@ public static class EnumerableExtensions
Func keySelector,
IComparer? comparer)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
- ArgumentNullException.ThrowIfNull(keySelector);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
@@ -309,7 +274,6 @@ public static class EnumerableExtensions
{
throw new ArgumentNullException(nameof(keySelector));
}
-#endif
comparer ??= Comparer.Default;
TSource? minValue;
diff --git a/X10D/src/Linq/Int32Extensions.cs b/X10D/src/Linq/Int32Extensions.cs
index 871e422..876f373 100644
--- a/X10D/src/Linq/Int32Extensions.cs
+++ b/X10D/src/Linq/Int32Extensions.cs
@@ -15,14 +15,10 @@ public static class Int32Extensions
/// is .
public static int Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate(1, (current, value) => current * value);
}
@@ -36,14 +32,10 @@ public static class Int32Extensions
[CLSCompliant(false)]
public static uint Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate(1u, (current, value) => current * value);
}
@@ -59,14 +51,10 @@ public static class Int32Extensions
/// is .
public static int Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
@@ -83,14 +71,10 @@ public static class Int32Extensions
[CLSCompliant(false)]
public static uint Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
diff --git a/X10D/src/Linq/Int64Extensions.cs b/X10D/src/Linq/Int64Extensions.cs
index 07b9802..00061d4 100644
--- a/X10D/src/Linq/Int64Extensions.cs
+++ b/X10D/src/Linq/Int64Extensions.cs
@@ -15,14 +15,10 @@ public static class Int64Extensions
/// is .
public static long Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate(1L, (current, value) => current * value);
}
@@ -36,14 +32,10 @@ public static class Int64Extensions
[CLSCompliant(false)]
public static ulong Product(this IEnumerable source)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Aggregate(1UL, (current, value) => current * value);
}
@@ -59,14 +51,10 @@ public static class Int64Extensions
/// is .
public static long Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
@@ -83,14 +71,10 @@ public static class Int64Extensions
[CLSCompliant(false)]
public static ulong Product(this IEnumerable source, Func selector)
{
-#if NET6_0_OR_GREATER
- ArgumentNullException.ThrowIfNull(source);
-#else
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
-#endif
return source.Select(selector).Product();
}
diff --git a/X10D/src/Linq/ReadOnlySpanExtensions.cs b/X10D/src/Linq/ReadOnlySpanExtensions.cs
index bf0d1d3..9d20ff8 100644
--- a/X10D/src/Linq/ReadOnlySpanExtensions.cs
+++ b/X10D/src/Linq/ReadOnlySpanExtensions.cs
@@ -21,14 +21,10 @@ public static class ReadOnlySpanExtensions
[Pure]
public static bool All(this ReadOnlySpan