Skip to content

Commit

Permalink
Remove ExceptionArgument enum
Browse files Browse the repository at this point in the history
Removes the ExceptionArgument mechanism that
seems to predate the nameof language feature.
  • Loading branch information
eiriktsarpalis committed Nov 4, 2021
1 parent dfd7d00 commit 231b537
Show file tree
Hide file tree
Showing 43 changed files with 301 additions and 356 deletions.
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"sdk": {
"version": "6.0.100-rc.2.21505.57",
"allowPrerelease": true,
"rollForward": "major"
"allowPrerelease": true
},
"tools": {
"dotnet": "6.0.100-rc.2.21505.57"
Expand Down
14 changes: 7 additions & 7 deletions src/libraries/System.Linq/src/System/Linq/Aggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public static TSource Aggregate<TSource>(this IEnumerable<TSource> source, Func<
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (func == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.func);
ThrowHelper.ThrowArgumentNullException(nameof(func));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand All @@ -40,12 +40,12 @@ public static TAccumulate Aggregate<TSource, TAccumulate>(this IEnumerable<TSour
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (func == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.func);
ThrowHelper.ThrowArgumentNullException(nameof(func));
}

TAccumulate result = seed;
Expand All @@ -61,17 +61,17 @@ public static TResult Aggregate<TSource, TAccumulate, TResult>(this IEnumerable<
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (func == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.func);
ThrowHelper.ThrowArgumentNullException(nameof(func));
}

if (resultSelector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.resultSelector);
ThrowHelper.ThrowArgumentNullException(nameof(resultSelector));
}

TAccumulate result = seed;
Expand Down
10 changes: 5 additions & 5 deletions src/libraries/System.Linq/src/System/Linq/AnyAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static bool Any<TSource>(this IEnumerable<TSource> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (source is ICollection<TSource> collectionoft)
Expand Down Expand Up @@ -48,12 +48,12 @@ public static bool Any<TSource>(this IEnumerable<TSource> source, Func<TSource,
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (predicate == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.predicate);
ThrowHelper.ThrowArgumentNullException(nameof(predicate));
}

foreach (TSource element in source)
Expand All @@ -71,12 +71,12 @@ public static bool All<TSource>(this IEnumerable<TSource> source, Func<TSource,
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (predicate == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.predicate);
ThrowHelper.ThrowArgumentNullException(nameof(predicate));
}

foreach (TSource element in source)
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.Linq/src/System/Linq/AppendPrepend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static IEnumerable<TSource> Append<TSource>(this IEnumerable<TSource> sou
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

return source is AppendPrependIterator<TSource> appendable
Expand All @@ -24,7 +24,7 @@ public static IEnumerable<TSource> Prepend<TSource>(this IEnumerable<TSource> so
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

return source is AppendPrependIterator<TSource> appendable
Expand Down
60 changes: 30 additions & 30 deletions src/libraries/System.Linq/src/System/Linq/Average.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static double Average(this IEnumerable<int> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<int> e = source.GetEnumerator())
Expand Down Expand Up @@ -40,7 +40,7 @@ public static double Average(this IEnumerable<int> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<int?> e = source.GetEnumerator())
Expand Down Expand Up @@ -77,7 +77,7 @@ public static double Average(this IEnumerable<long> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<long> e = source.GetEnumerator())
Expand Down Expand Up @@ -106,7 +106,7 @@ public static double Average(this IEnumerable<long> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<long?> e = source.GetEnumerator())
Expand Down Expand Up @@ -143,7 +143,7 @@ public static float Average(this IEnumerable<float> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<float> e = source.GetEnumerator())
Expand All @@ -169,7 +169,7 @@ public static float Average(this IEnumerable<float> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<float?> e = source.GetEnumerator())
Expand Down Expand Up @@ -206,7 +206,7 @@ public static double Average(this IEnumerable<double> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<double> e = source.GetEnumerator())
Expand Down Expand Up @@ -235,7 +235,7 @@ public static double Average(this IEnumerable<double> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<double?> e = source.GetEnumerator())
Expand Down Expand Up @@ -272,7 +272,7 @@ public static decimal Average(this IEnumerable<decimal> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<decimal> e = source.GetEnumerator())
Expand All @@ -298,7 +298,7 @@ public static decimal Average(this IEnumerable<decimal> source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

using (IEnumerator<decimal?> e = source.GetEnumerator())
Expand Down Expand Up @@ -332,12 +332,12 @@ public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSo
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down Expand Up @@ -366,12 +366,12 @@ public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSo
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down Expand Up @@ -408,12 +408,12 @@ public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSo
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down Expand Up @@ -442,12 +442,12 @@ public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSo
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down Expand Up @@ -484,12 +484,12 @@ public static float Average<TSource>(this IEnumerable<TSource> source, Func<TSou
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand All @@ -515,12 +515,12 @@ public static float Average<TSource>(this IEnumerable<TSource> source, Func<TSou
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down Expand Up @@ -557,12 +557,12 @@ public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSo
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down Expand Up @@ -591,12 +591,12 @@ public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSo
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down Expand Up @@ -633,12 +633,12 @@ public static decimal Average<TSource>(this IEnumerable<TSource> source, Func<TS
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand All @@ -664,12 +664,12 @@ public static decimal Average<TSource>(this IEnumerable<TSource> source, Func<TS
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (selector == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.selector);
ThrowHelper.ThrowArgumentNullException(nameof(selector));
}

using (IEnumerator<TSource> e = source.GetEnumerator())
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.Linq/src/System/Linq/Cast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static IEnumerable<TResult> OfType<TResult>(this IEnumerable source)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

return OfTypeIterator<TResult>(source);
Expand Down Expand Up @@ -42,7 +42,7 @@ public static IEnumerable<

if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

return CastIterator<TResult>(source);
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.Linq/src/System/Linq/Chunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public static IEnumerable<TSource[]> Chunk<TSource>(this IEnumerable<TSource> so
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
ThrowHelper.ThrowArgumentNullException(nameof(source));
}

if (size < 1)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.size);
ThrowHelper.ThrowArgumentOutOfRangeException(nameof(size));
}

return ChunkIterator(source, size);
Expand Down
Loading

0 comments on commit 231b537

Please sign in to comment.