浏览代码

Use nameof operator

Oren Novotny 9 年之前
父节点
当前提交
04eb25d644

+ 2 - 2
Ix.NET/Source/System.Interactive.Async.Providers/AsyncEnumerableQuery.cs

@@ -129,12 +129,12 @@ namespace System.Linq
         {
             if (expression == null)
             {
-                throw new ArgumentNullException("expression");
+                throw new ArgumentNullException(nameof(expression));
             }
 
             if (!typeof(Task<TResult>).IsAssignableFrom(expression.Type))
             {
-                throw new ArgumentException("The specified expression is not assignable to the result type.", "expression");
+                throw new ArgumentException("The specified expression is not assignable to the result type.", nameof(expression));
             }
 
             return new AsyncEnumerableExecutor<TResult>(expression).ExecuteAsync(token);

+ 1 - 1
Ix.NET/Source/System.Interactive.Async.Providers/AsyncQueryable.cs

@@ -21,7 +21,7 @@ namespace System.Linq
         public static IAsyncQueryable<TElement> AsAsyncQueryable<TElement>(this IAsyncEnumerable<TElement> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             var queryable = source as IAsyncQueryable<TElement>;
             if (queryable != null)

+ 126 - 126
Ix.NET/Source/System.Interactive.Providers/QueryableEx.cs

@@ -23,7 +23,7 @@ namespace System.Linq
         public static bool IsEmpty<TSource>(this IQueryable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.Execute<bool>(
                 Expression.Call(
@@ -56,9 +56,9 @@ namespace System.Linq
         public static TSource Min<TSource>(this IQueryable<TSource> source, IComparer<TSource> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Provider.Execute<TSource>(
                 Expression.Call(
@@ -93,9 +93,9 @@ namespace System.Linq
         public static IList<TSource> MinBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return source.Provider.Execute<IList<TSource>>(
                 Expression.Call(
@@ -131,11 +131,11 @@ namespace System.Linq
         public static IList<TSource> MinBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Provider.Execute<IList<TSource>>(
                 Expression.Call(
@@ -170,9 +170,9 @@ namespace System.Linq
         public static TSource Max<TSource>(this IQueryable<TSource> source, IComparer<TSource> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Provider.Execute<TSource>(
                 Expression.Call(
@@ -207,9 +207,9 @@ namespace System.Linq
         public static IList<TSource> MaxBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return source.Provider.Execute<IList<TSource>>(
                 Expression.Call(
@@ -245,11 +245,11 @@ namespace System.Linq
         public static IList<TSource> MaxBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Provider.Execute<IList<TSource>>(
                 Expression.Call(
@@ -285,9 +285,9 @@ namespace System.Linq
         public static IQueryable<TResult> Share<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<IEnumerable<TSource>, IEnumerable<TResult>>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return source.Provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -322,9 +322,9 @@ namespace System.Linq
         public static IQueryable<TResult> Publish<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<IEnumerable<TSource>, IEnumerable<TResult>>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return source.Provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -359,9 +359,9 @@ namespace System.Linq
         public static IQueryable<TResult> Memoize<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<IEnumerable<TSource>, IEnumerable<TResult>>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return source.Provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -397,9 +397,9 @@ namespace System.Linq
         public static IQueryable<TResult> Memoize<TSource, TResult>(this IQueryable<TSource> source, int readerCount, Expression<Func<IEnumerable<TSource>, IEnumerable<TResult>>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return source.Provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -434,9 +434,9 @@ namespace System.Linq
         public static IQueryable<TResult> Create<TResult>(this IQueryProvider provider, Expression<Func<IEnumerator<TResult>>> getEnumerator)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (getEnumerator == null)
-                throw new ArgumentNullException("getEnumerator");
+                throw new ArgumentNullException(nameof(getEnumerator));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -470,7 +470,7 @@ namespace System.Linq
         public static IQueryable<TResult> Return<TResult>(this IQueryProvider provider, TResult value)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -504,9 +504,9 @@ namespace System.Linq
         public static IQueryable<TResult> Throw<TResult>(this IQueryProvider provider, Exception exception)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (exception == null)
-                throw new ArgumentNullException("exception");
+                throw new ArgumentNullException(nameof(exception));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -540,9 +540,9 @@ namespace System.Linq
         public static IQueryable<TResult> Defer<TResult>(this IQueryProvider provider, Expression<Func<IEnumerable<TResult>>> enumerableFactory)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (enumerableFactory == null)
-                throw new ArgumentNullException("enumerableFactory");
+                throw new ArgumentNullException(nameof(enumerableFactory));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -580,13 +580,13 @@ namespace System.Linq
         public static IQueryable<TResult> Generate<TState, TResult>(this IQueryProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (iterate == null)
-                throw new ArgumentNullException("iterate");
+                throw new ArgumentNullException(nameof(iterate));
             if (resultSelector == null)
-                throw new ArgumentNullException("resultSelector");
+                throw new ArgumentNullException(nameof(resultSelector));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -625,11 +625,11 @@ namespace System.Linq
         public static IQueryable<TSource> Using<TSource, TResource>(this IQueryProvider provider, Expression<Func<TResource>> resourceFactory, Expression<Func<TResource, IEnumerable<TSource>>> enumerableFactory) where TResource : IDisposable
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (resourceFactory == null)
-                throw new ArgumentNullException("resourceFactory");
+                throw new ArgumentNullException(nameof(resourceFactory));
             if (enumerableFactory == null)
-                throw new ArgumentNullException("enumerableFactory");
+                throw new ArgumentNullException(nameof(enumerableFactory));
 
             return provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -664,7 +664,7 @@ namespace System.Linq
         public static IEnumerable<TResult> Repeat<TResult>(this IQueryProvider provider, TResult value)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -700,9 +700,9 @@ namespace System.Linq
             where TException : Exception
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (handler == null)
-                throw new ArgumentNullException("handler");
+                throw new ArgumentNullException(nameof(handler));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -736,7 +736,7 @@ namespace System.Linq
         public static IQueryable<TSource> Catch<TSource>(this IQueryable<IEnumerable<TSource>> sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return sources.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -769,9 +769,9 @@ namespace System.Linq
         public static IQueryable<TSource> Catch<TSource>(this IQueryProvider provider, params IEnumerable<TSource>[] sources)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -805,9 +805,9 @@ namespace System.Linq
         public static IQueryable<TSource> Catch<TSource>(this IQueryable<TSource> first, IEnumerable<TSource> second)
         {
             if (first == null)
-                throw new ArgumentNullException("first");
+                throw new ArgumentNullException(nameof(first));
             if (second == null)
-                throw new ArgumentNullException("second");
+                throw new ArgumentNullException(nameof(second));
 
             return first.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -841,9 +841,9 @@ namespace System.Linq
         public static IQueryable<TSource> Finally<TSource>(this IQueryable<TSource> source, Expression<Action> finallyAction)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (finallyAction == null)
-                throw new ArgumentNullException("finallyAction");
+                throw new ArgumentNullException(nameof(finallyAction));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -877,9 +877,9 @@ namespace System.Linq
         public static IQueryable<TSource> OnErrorResumeNext<TSource>(this IQueryable<TSource> first, IEnumerable<TSource> second)
         {
             if (first == null)
-                throw new ArgumentNullException("first");
+                throw new ArgumentNullException(nameof(first));
             if (second == null)
-                throw new ArgumentNullException("second");
+                throw new ArgumentNullException(nameof(second));
 
             return first.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -913,9 +913,9 @@ namespace System.Linq
         public static IEnumerable<TSource> OnErrorResumeNext<TSource>(this IQueryProvider provider, params IEnumerable<TSource>[] sources)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -948,7 +948,7 @@ namespace System.Linq
         public static IQueryable<TSource> OnErrorResumeNext<TSource>(this IQueryable<IEnumerable<TSource>> sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return sources.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -980,7 +980,7 @@ namespace System.Linq
         public static IQueryable<TSource> Retry<TSource>(this IQueryable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1013,7 +1013,7 @@ namespace System.Linq
         public static IQueryable<TSource> Retry<TSource>(this IQueryable<TSource> source, int retryCount)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1048,11 +1048,11 @@ namespace System.Linq
         public static IQueryable<TResult> While<TResult>(this IQueryProvider provider, Expression<Func<bool>> condition, IEnumerable<TResult> source)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -1089,13 +1089,13 @@ namespace System.Linq
         public static IQueryable<TResult> If<TResult>(this IQueryProvider provider, Expression<Func<bool>> condition, IEnumerable<TResult> thenSource, IEnumerable<TResult> elseSource)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (thenSource == null)
-                throw new ArgumentNullException("thenSource");
+                throw new ArgumentNullException(nameof(thenSource));
             if (elseSource == null)
-                throw new ArgumentNullException("elseSource");
+                throw new ArgumentNullException(nameof(elseSource));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -1132,11 +1132,11 @@ namespace System.Linq
         public static IQueryable<TResult> If<TResult>(this IQueryProvider provider, Expression<Func<bool>> condition, IEnumerable<TResult> thenSource)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (thenSource == null)
-                throw new ArgumentNullException("thenSource");
+                throw new ArgumentNullException(nameof(thenSource));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -1171,9 +1171,9 @@ namespace System.Linq
         public static IQueryable<TResult> DoWhile<TResult>(this IQueryable<TResult> source, Expression<Func<bool>> condition)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
 
             return source.Provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -1209,11 +1209,11 @@ namespace System.Linq
         public static IQueryable<TResult> Case<TValue, TResult>(this IQueryProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IEnumerable<TResult>> sources)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -1250,13 +1250,13 @@ namespace System.Linq
         public static IQueryable<TResult> Case<TValue, TResult>(this IQueryProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IEnumerable<TResult>> sources, IEnumerable<TResult> defaultSource)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
             if (defaultSource == null)
-                throw new ArgumentNullException("defaultSource");
+                throw new ArgumentNullException(nameof(defaultSource));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -1292,11 +1292,11 @@ namespace System.Linq
         public static IQueryable<TResult> For<TSource, TResult>(this IQueryProvider provider, IEnumerable<TSource> source, Expression<Func<TSource, IEnumerable<TResult>>> resultSelector)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (resultSelector == null)
-                throw new ArgumentNullException("resultSelector");
+                throw new ArgumentNullException(nameof(resultSelector));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -1329,7 +1329,7 @@ namespace System.Linq
         public static IQueryable<TSource> Concat<TSource>(this IQueryable<IEnumerable<TSource>> sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return sources.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1362,9 +1362,9 @@ namespace System.Linq
         public static IQueryable<TSource> Concat<TSource>(this IQueryProvider provider, params IEnumerable<TSource>[] sources)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1399,9 +1399,9 @@ namespace System.Linq
         public static IQueryable<TOther> SelectMany<TSource, TOther>(this IQueryable<TSource> source, IEnumerable<TOther> other)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (other == null)
-                throw new ArgumentNullException("other");
+                throw new ArgumentNullException(nameof(other));
 
             return source.Provider.CreateQuery<TOther>(
                 Expression.Call(
@@ -1479,7 +1479,7 @@ namespace System.Linq
         public static IQueryable<TSource> Hide<TSource>(this IQueryable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1512,9 +1512,9 @@ namespace System.Linq
         public static IQueryable<TSource> Do<TSource>(this IQueryable<TSource> source, Expression<Action<TSource>> onNext)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1549,11 +1549,11 @@ namespace System.Linq
         public static IQueryable<TSource> Do<TSource>(this IQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action> onCompleted)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
             if (onCompleted == null)
-                throw new ArgumentNullException("onCompleted");
+                throw new ArgumentNullException(nameof(onCompleted));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1589,11 +1589,11 @@ namespace System.Linq
         public static IQueryable<TSource> Do<TSource>(this IQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
             if (onError == null)
-                throw new ArgumentNullException("onError");
+                throw new ArgumentNullException(nameof(onError));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1630,13 +1630,13 @@ namespace System.Linq
         public static IQueryable<TSource> Do<TSource>(this IQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError, Expression<Action> onCompleted)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
             if (onError == null)
-                throw new ArgumentNullException("onError");
+                throw new ArgumentNullException(nameof(onError));
             if (onCompleted == null)
-                throw new ArgumentNullException("onCompleted");
+                throw new ArgumentNullException(nameof(onCompleted));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1673,9 +1673,9 @@ namespace System.Linq
         public static IQueryable<TSource> Do<TSource>(this IQueryable<TSource> source, IObserver<TSource> observer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (observer == null)
-                throw new ArgumentNullException("observer");
+                throw new ArgumentNullException(nameof(observer));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1710,7 +1710,7 @@ namespace System.Linq
         public static IQueryable<IList<TSource>> Buffer<TSource>(this IQueryable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<IList<TSource>>(
                 Expression.Call(
@@ -1745,7 +1745,7 @@ namespace System.Linq
         public static IQueryable<IList<TSource>> Buffer<TSource>(this IQueryable<TSource> source, int count, int skip)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<IList<TSource>>(
                 Expression.Call(
@@ -1779,7 +1779,7 @@ namespace System.Linq
         public static IQueryable<TSource> IgnoreElements<TSource>(this IQueryable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1813,9 +1813,9 @@ namespace System.Linq
         public static IQueryable<TSource> Distinct<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1851,11 +1851,11 @@ namespace System.Linq
         public static IQueryable<TSource> Distinct<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1889,7 +1889,7 @@ namespace System.Linq
         public static IQueryable<TSource> DistinctUntilChanged<TSource>(this IQueryable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1922,9 +1922,9 @@ namespace System.Linq
         public static IQueryable<TSource> DistinctUntilChanged<TSource>(this IQueryable<TSource> source, IEqualityComparer<TSource> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1959,9 +1959,9 @@ namespace System.Linq
         public static IQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -1997,11 +1997,11 @@ namespace System.Linq
         public static IQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2036,9 +2036,9 @@ namespace System.Linq
         public static IQueryable<TSource> Expand<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TSource>>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2072,7 +2072,7 @@ namespace System.Linq
         public static IQueryable<TSource> StartWith<TSource>(this IQueryable<TSource> source, params TSource[] values)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2108,9 +2108,9 @@ namespace System.Linq
         public static IQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
-                throw new ArgumentNullException("accumulator");
+                throw new ArgumentNullException(nameof(accumulator));
 
             return source.Provider.CreateQuery<TAccumulate>(
                 Expression.Call(
@@ -2145,9 +2145,9 @@ namespace System.Linq
         public static IQueryable<TSource> Scan<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
-                throw new ArgumentNullException("accumulator");
+                throw new ArgumentNullException(nameof(accumulator));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2181,7 +2181,7 @@ namespace System.Linq
         public static IQueryable<TSource> TakeLast<TSource>(this IQueryable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2215,7 +2215,7 @@ namespace System.Linq
         public static IQueryable<TSource> SkipLast<TSource>(this IQueryable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2248,7 +2248,7 @@ namespace System.Linq
         public static IQueryable<TSource> Repeat<TSource>(this IQueryable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2281,7 +2281,7 @@ namespace System.Linq
         public static IQueryable<TSource> Repeat<TSource>(this IQueryable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Provider.CreateQuery<TSource>(
                 Expression.Call(
@@ -2314,7 +2314,7 @@ namespace System.Linq
         public static IQueryable<TResult> Empty<TResult>(this IQueryProvider provider)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(
@@ -2347,7 +2347,7 @@ namespace System.Linq
         public static IQueryable<int> Range(this IQueryProvider provider, int start, int count)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
 
             return provider.CreateQuery<int>(
                 Expression.Call(
@@ -2383,7 +2383,7 @@ namespace System.Linq
         public static IQueryable<TResult> Repeat<TResult>(this IQueryProvider provider, TResult element, int count)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
 
             return provider.CreateQuery<TResult>(
                 Expression.Call(

+ 15 - 15
Ix.NET/Source/System.Interactive/EnumerableEx.Aggregates.cs

@@ -21,7 +21,7 @@ namespace System.Linq
         public static bool IsEmpty<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return !source.Any();
         }
@@ -36,9 +36,9 @@ namespace System.Linq
         public static TSource Min<TSource>(this IEnumerable<TSource> source, IComparer<TSource> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return MinBy(source, x => x, comparer).First();
         }
@@ -54,9 +54,9 @@ namespace System.Linq
         public static IList<TSource> MinBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return MinBy(source, keySelector, Comparer<TKey>.Default);
         }
@@ -73,11 +73,11 @@ namespace System.Linq
         public static IList<TSource> MinBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return ExtremaBy(source, keySelector, (key, minValue) => -comparer.Compare(key, minValue));
         }
@@ -92,9 +92,9 @@ namespace System.Linq
         public static TSource Max<TSource>(this IEnumerable<TSource> source, IComparer<TSource> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return MaxBy(source, x => x, comparer).First();
         }
@@ -110,9 +110,9 @@ namespace System.Linq
         public static IList<TSource> MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return MaxBy(source, keySelector, Comparer<TKey>.Default);
         }
@@ -129,11 +129,11 @@ namespace System.Linq
         public static IList<TSource> MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return ExtremaBy(source, keySelector, (key, minValue) => comparer.Compare(key, minValue));
         }

+ 14 - 14
Ix.NET/Source/System.Interactive/EnumerableEx.Buffering.cs

@@ -36,7 +36,7 @@ namespace System.Linq
         public static IBuffer<TSource> Share<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return new SharedBuffer<TSource>(source.GetEnumerator());
         }
@@ -52,9 +52,9 @@ namespace System.Linq
         public static IEnumerable<TResult> Share<TSource, TResult>(this IEnumerable<TSource> source, Func<IEnumerable<TSource>, IEnumerable<TResult>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return Create<TResult>(() => selector(source.Share()).GetEnumerator());
         }
@@ -152,7 +152,7 @@ namespace System.Linq
         public static IBuffer<TSource> Publish<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return new PublishedBuffer<TSource>(source.GetEnumerator());
         }
@@ -168,9 +168,9 @@ namespace System.Linq
         public static IEnumerable<TResult> Publish<TSource, TResult>(this IEnumerable<TSource> source, Func<IEnumerable<TSource>, IEnumerable<TResult>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return Create<TResult>(() => selector(source.Publish()).GetEnumerator());
         }
@@ -325,7 +325,7 @@ namespace System.Linq
         public static IBuffer<TSource> Memoize<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return new MemoizedBuffer<TSource>(source.GetEnumerator());
         }
@@ -341,9 +341,9 @@ namespace System.Linq
         public static IEnumerable<TResult> Memoize<TSource, TResult>(this IEnumerable<TSource> source, Func<IEnumerable<TSource>, IEnumerable<TResult>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return Create<TResult>(() => selector(source.Memoize()).GetEnumerator());
         }
@@ -358,9 +358,9 @@ namespace System.Linq
         public static IBuffer<TSource> Memoize<TSource>(this IEnumerable<TSource> source, int readerCount)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (readerCount <= 0)
-                throw new ArgumentOutOfRangeException("readerCount");
+                throw new ArgumentOutOfRangeException(nameof(readerCount));
 
             return new MemoizedBuffer<TSource>(source.GetEnumerator(), readerCount);
         }
@@ -377,11 +377,11 @@ namespace System.Linq
         public static IEnumerable<TResult> Memoize<TSource, TResult>(this IEnumerable<TSource> source, int readerCount, Func<IEnumerable<TSource>, IEnumerable<TResult>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (readerCount <= 0)
-                throw new ArgumentOutOfRangeException("readerCount");
+                throw new ArgumentOutOfRangeException(nameof(readerCount));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return Create<TResult>(() => selector(source.Memoize(readerCount)).GetEnumerator());
         }

+ 9 - 9
Ix.NET/Source/System.Interactive/EnumerableEx.Creation.cs

@@ -17,7 +17,7 @@ namespace System.Linq
         public static IEnumerable<TResult> Create<TResult>(Func<IEnumerator<TResult>> getEnumerator)
         {
             if (getEnumerator == null)
-                throw new ArgumentNullException("getEnumerator");
+                throw new ArgumentNullException(nameof(getEnumerator));
 
             return new AnonymousEnumerable<TResult>(getEnumerator);
         }
@@ -32,7 +32,7 @@ namespace System.Linq
         public static IEnumerable<T> Create<T>(Action<IYielder<T>> create)
         {
             if (create == null)
-                throw new ArgumentNullException("create");
+                throw new ArgumentNullException(nameof(create));
 
             foreach (var x in new Yielder<T>(create))
                 yield return x;
@@ -79,7 +79,7 @@ namespace System.Linq
         public static IEnumerable<TResult> Throw<TResult>(Exception exception)
         {
             if (exception == null)
-                throw new ArgumentNullException("exception");
+                throw new ArgumentNullException(nameof(exception));
 
             return Throw_<TResult>(exception);
         }
@@ -101,7 +101,7 @@ namespace System.Linq
         public static IEnumerable<TResult> Defer<TResult>(Func<IEnumerable<TResult>> enumerableFactory)
         {
             if (enumerableFactory == null)
-                throw new ArgumentNullException("enumerableFactory");
+                throw new ArgumentNullException(nameof(enumerableFactory));
 
             return Defer_(enumerableFactory);
         }
@@ -125,11 +125,11 @@ namespace System.Linq
         public static IEnumerable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
         {
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (iterate == null)
-                throw new ArgumentNullException("iterate");
+                throw new ArgumentNullException(nameof(iterate));
             if (resultSelector == null)
-                throw new ArgumentNullException("resultSelector");
+                throw new ArgumentNullException(nameof(resultSelector));
 
             return Generate_(initialState, condition, iterate, resultSelector);
         }
@@ -151,9 +151,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Using<TSource, TResource>(Func<TResource> resourceFactory, Func<TResource, IEnumerable<TSource>> enumerableFactory) where TResource : IDisposable
         {
             if (resourceFactory == null)
-                throw new ArgumentNullException("resourceFactory");
+                throw new ArgumentNullException(nameof(resourceFactory));
             if (enumerableFactory == null)
-                throw new ArgumentNullException("enumerableFactory");
+                throw new ArgumentNullException(nameof(enumerableFactory));
 
             return Using_(resourceFactory, enumerableFactory);
         }

+ 15 - 15
Ix.NET/Source/System.Interactive/EnumerableEx.Exceptions.cs

@@ -21,9 +21,9 @@ namespace System.Linq
             where TException : Exception
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (handler == null)
-                throw new ArgumentNullException("handler");
+                throw new ArgumentNullException(nameof(handler));
 
             return source.Catch_(handler);
         }
@@ -72,7 +72,7 @@ namespace System.Linq
         public static IEnumerable<TSource> Catch<TSource>(this IEnumerable<IEnumerable<TSource>> sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return sources.Catch_();
         }
@@ -86,7 +86,7 @@ namespace System.Linq
         public static IEnumerable<TSource> Catch<TSource>(params IEnumerable<TSource>[] sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return sources.Catch_();
         }
@@ -101,9 +101,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Catch<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
         {
             if (first == null)
-                throw new ArgumentNullException("first");
+                throw new ArgumentNullException(nameof(first));
             if (second == null)
-                throw new ArgumentNullException("second");
+                throw new ArgumentNullException(nameof(second));
 
             return new[] { first, second }.Catch_();
         }
@@ -157,9 +157,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Finally<TSource>(this IEnumerable<TSource> source, Action finallyAction)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (finallyAction == null)
-                throw new ArgumentNullException("finallyAction");
+                throw new ArgumentNullException(nameof(finallyAction));
 
             return source.Finally_(finallyAction);
         }
@@ -187,9 +187,9 @@ namespace System.Linq
         public static IEnumerable<TSource> OnErrorResumeNext<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
         {
             if (first == null)
-                throw new ArgumentNullException("first");
+                throw new ArgumentNullException(nameof(first));
             if (second == null)
-                throw new ArgumentNullException("second");
+                throw new ArgumentNullException(nameof(second));
 
             return OnErrorResumeNext_(new[] { first, second });
         }
@@ -203,7 +203,7 @@ namespace System.Linq
         public static IEnumerable<TSource> OnErrorResumeNext<TSource>(params IEnumerable<TSource>[] sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return OnErrorResumeNext_(sources);
         }
@@ -217,7 +217,7 @@ namespace System.Linq
         public static IEnumerable<TSource> OnErrorResumeNext<TSource>(this IEnumerable<IEnumerable<TSource>> sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return OnErrorResumeNext_(sources);
         }
@@ -257,7 +257,7 @@ namespace System.Linq
         public static IEnumerable<TSource> Retry<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return new[] { source }.Repeat().Catch();
         }
@@ -272,9 +272,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Retry<TSource>(this IEnumerable<TSource> source, int retryCount)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (retryCount < 0)
-                throw new ArgumentOutOfRangeException("retryCount");
+                throw new ArgumentOutOfRangeException(nameof(retryCount));
 
             return new[] { source }.Repeat(retryCount).Catch();
         }

+ 16 - 16
Ix.NET/Source/System.Interactive/EnumerableEx.Imperative.cs

@@ -20,9 +20,9 @@ namespace System.Linq
         public static IEnumerable<TResult> While<TResult>(Func<bool> condition, IEnumerable<TResult> source)
         {
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return WhileCore(condition, source).Concat();
         }
@@ -44,11 +44,11 @@ namespace System.Linq
         public static IEnumerable<TResult> If<TResult>(Func<bool> condition, IEnumerable<TResult> thenSource, IEnumerable<TResult> elseSource)
         {
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (thenSource == null)
-                throw new ArgumentNullException("thenSource");
+                throw new ArgumentNullException(nameof(thenSource));
             if (elseSource == null)
-                throw new ArgumentNullException("elseSource");
+                throw new ArgumentNullException(nameof(elseSource));
 
             return EnumerableEx.Defer(() => condition() ? thenSource : elseSource);
         }
@@ -63,9 +63,9 @@ namespace System.Linq
         public static IEnumerable<TResult> If<TResult>(Func<bool> condition, IEnumerable<TResult> thenSource)
         {
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
             if (thenSource == null)
-                throw new ArgumentNullException("thenSource");
+                throw new ArgumentNullException(nameof(thenSource));
 
             return EnumerableEx.Defer(() => condition() ? thenSource : Enumerable.Empty<TResult>());
         }
@@ -80,9 +80,9 @@ namespace System.Linq
         public static IEnumerable<TResult> DoWhile<TResult>(this IEnumerable<TResult> source, Func<bool> condition)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (condition == null)
-                throw new ArgumentNullException("condition");
+                throw new ArgumentNullException(nameof(condition));
 
             return source.Concat(While(condition, source));
         }
@@ -98,9 +98,9 @@ namespace System.Linq
         public static IEnumerable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IEnumerable<TResult>> sources)
         {
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return Case(selector, sources, Enumerable.Empty<TResult>());
         }
@@ -117,11 +117,11 @@ namespace System.Linq
         public static IEnumerable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IEnumerable<TResult>> sources, IEnumerable<TResult> defaultSource)
         {
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
             if (defaultSource == null)
-                throw new ArgumentNullException("defaultSource");
+                throw new ArgumentNullException(nameof(defaultSource));
 
             return EnumerableEx.Defer(() =>
             {
@@ -143,9 +143,9 @@ namespace System.Linq
         public static IEnumerable<TResult> For<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> resultSelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (resultSelector == null)
-                throw new ArgumentNullException("resultSelector");
+                throw new ArgumentNullException(nameof(resultSelector));
 
             return ForCore(source, resultSelector).Concat();
         }

+ 4 - 4
Ix.NET/Source/System.Interactive/EnumerableEx.Multiple.cs

@@ -19,7 +19,7 @@ namespace System.Linq
         public static IEnumerable<TSource> Concat<TSource>(this IEnumerable<IEnumerable<TSource>> sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return sources.Concat_();
         }
@@ -33,7 +33,7 @@ namespace System.Linq
         public static IEnumerable<TSource> Concat<TSource>(params IEnumerable<TSource>[] sources)
         {
             if (sources == null)
-                throw new ArgumentNullException("sources");
+                throw new ArgumentNullException(nameof(sources));
 
             return sources.Concat_();
         }
@@ -56,9 +56,9 @@ namespace System.Linq
         public static IEnumerable<TOther> SelectMany<TSource, TOther>(this IEnumerable<TSource> source, IEnumerable<TOther> other)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (other == null)
-                throw new ArgumentNullException("other");
+                throw new ArgumentNullException(nameof(other));
 
             return source.SelectMany(_ => other);
         }

+ 52 - 52
Ix.NET/Source/System.Interactive/EnumerableEx.Single.cs

@@ -20,7 +20,7 @@ namespace System.Linq
         public static IEnumerable<TSource> Hide<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.Hide_();
         }
@@ -40,9 +40,9 @@ namespace System.Linq
         public static void ForEach<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
 
             foreach (var item in source)
                 onNext(item);
@@ -57,9 +57,9 @@ namespace System.Linq
         public static void ForEach<TSource>(this IEnumerable<TSource> source, Action<TSource, int> onNext)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
 
             var i = 0;
             foreach (var item in source)
@@ -76,9 +76,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
 
             return DoHelper(source, onNext, _ => { }, () => { });
         }
@@ -94,11 +94,11 @@ namespace System.Linq
         public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action onCompleted)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
             if (onCompleted == null)
-                throw new ArgumentNullException("onCompleted");
+                throw new ArgumentNullException(nameof(onCompleted));
 
             return DoHelper(source, onNext, _ => { }, onCompleted);
         }
@@ -114,11 +114,11 @@ namespace System.Linq
         public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
             if (onError == null)
-                throw new ArgumentNullException("onError");
+                throw new ArgumentNullException(nameof(onError));
 
             return DoHelper(source, onNext, onError, () => { });
         }
@@ -135,13 +135,13 @@ namespace System.Linq
         public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (onNext == null)
-                throw new ArgumentNullException("onNext");
+                throw new ArgumentNullException(nameof(onNext));
             if (onError == null)
-                throw new ArgumentNullException("onError");
+                throw new ArgumentNullException(nameof(onError));
             if (onCompleted == null)
-                throw new ArgumentNullException("onCompleted");
+                throw new ArgumentNullException(nameof(onCompleted));
 
             return DoHelper(source, onNext, onError, onCompleted);
         }
@@ -157,9 +157,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, IObserver<TSource> observer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (observer == null)
-                throw new ArgumentNullException("observer");
+                throw new ArgumentNullException(nameof(observer));
 
             return DoHelper(source, observer.OnNext, observer.OnError, observer.OnCompleted);
         }
@@ -203,9 +203,9 @@ namespace System.Linq
         public static IEnumerable<IList<TSource>> Buffer<TSource>(this IEnumerable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (count <= 0)
-                throw new ArgumentOutOfRangeException("count");
+                throw new ArgumentOutOfRangeException(nameof(count));
 
             return source.Buffer_(count, count);
         }
@@ -221,11 +221,11 @@ namespace System.Linq
         public static IEnumerable<IList<TSource>> Buffer<TSource>(this IEnumerable<TSource> source, int count, int skip)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (count <= 0)
-                throw new ArgumentOutOfRangeException("count");
+                throw new ArgumentOutOfRangeException(nameof(count));
             if (skip <= 0)
-                throw new ArgumentOutOfRangeException("skip");
+                throw new ArgumentOutOfRangeException(nameof(skip));
 
             return source.Buffer_(count, skip);
         }
@@ -262,7 +262,7 @@ namespace System.Linq
         public static IEnumerable<TSource> IgnoreElements<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.IgnoreElements_();
         }
@@ -286,9 +286,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return source.Distinct_(keySelector, EqualityComparer<TKey>.Default);
         }
@@ -305,11 +305,11 @@ namespace System.Linq
         public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.Distinct_(keySelector, comparer);
         }
@@ -356,7 +356,7 @@ namespace System.Linq
         public static IEnumerable<TSource> DistinctUntilChanged<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.DistinctUntilChanged_(x => x, EqualityComparer<TSource>.Default);
         }
@@ -371,9 +371,9 @@ namespace System.Linq
         public static IEnumerable<TSource> DistinctUntilChanged<TSource>(this IEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.DistinctUntilChanged_(x => x, comparer);
         }
@@ -389,9 +389,9 @@ namespace System.Linq
         public static IEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
 
             return source.DistinctUntilChanged_(keySelector, EqualityComparer<TKey>.Default);
         }
@@ -408,11 +408,11 @@ namespace System.Linq
         public static IEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (keySelector == null)
-                throw new ArgumentNullException("keySelector");
+                throw new ArgumentNullException(nameof(keySelector));
             if (comparer == null)
-                throw new ArgumentNullException("comparer");
+                throw new ArgumentNullException(nameof(comparer));
 
             return source.DistinctUntilChanged_(keySelector, comparer);
         }
@@ -451,9 +451,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Expand<TSource>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TSource>> selector)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (selector == null)
-                throw new ArgumentNullException("selector");
+                throw new ArgumentNullException(nameof(selector));
 
             return source.Expand_(selector);
         }
@@ -485,7 +485,7 @@ namespace System.Linq
         public static IEnumerable<TSource> StartWith<TSource>(this IEnumerable<TSource> source, params TSource[] values)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return source.StartWith_(values);
         }
@@ -511,9 +511,9 @@ namespace System.Linq
         public static IEnumerable<TAccumulate> Scan<TSource, TAccumulate>(this IEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
-                throw new ArgumentNullException("accumulator");
+                throw new ArgumentNullException(nameof(accumulator));
 
             return source.Scan_(seed, accumulator);
         }
@@ -539,9 +539,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Scan<TSource>(this IEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
-                throw new ArgumentNullException("accumulator");
+                throw new ArgumentNullException(nameof(accumulator));
 
             return source.Scan_(accumulator);
         }
@@ -575,9 +575,9 @@ namespace System.Linq
         public static IEnumerable<TSource> TakeLast<TSource>(this IEnumerable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (count < 0)
-                throw new ArgumentOutOfRangeException("count");
+                throw new ArgumentOutOfRangeException(nameof(count));
 
             return source.TakeLast_(count);
         }
@@ -612,9 +612,9 @@ namespace System.Linq
         public static IEnumerable<TSource> SkipLast<TSource>(this IEnumerable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (count < 0)
-                throw new ArgumentOutOfRangeException("count");
+                throw new ArgumentOutOfRangeException(nameof(count));
 
             return source.SkipLast_(count);
         }
@@ -640,7 +640,7 @@ namespace System.Linq
         public static IEnumerable<TSource> Repeat<TSource>(this IEnumerable<TSource> source)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             return Repeat_(source);
         }
@@ -662,9 +662,9 @@ namespace System.Linq
         public static IEnumerable<TSource> Repeat<TSource>(this IEnumerable<TSource> source, int count)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (count < 0)
-                throw new ArgumentOutOfRangeException("count");
+                throw new ArgumentOutOfRangeException(nameof(count));
 
             return Repeat_(source, count);
         }