瀏覽代碼

i think we can trust the comparer has been set by the public API surface

Brendan Forster 9 年之前
父節點
當前提交
7f2c0d6bf5
共有 1 個文件被更改,包括 7 次插入9 次删除
  1. 7 9
      Ix.NET/Source/System.Interactive.Async/OrderedAsyncEnumerable.cs

+ 7 - 9
Ix.NET/Source/System.Interactive.Async/OrderedAsyncEnumerable.cs

@@ -2,9 +2,8 @@
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
-using System;
 using System.Collections.Generic;
-using System.Linq;
+using System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -28,21 +27,20 @@ namespace System.Linq
         private readonly IComparer<TKey> comparer;
         private readonly bool descending;
         private readonly Func<TElement, TKey> keySelector;
-
+        private readonly OrderedAsyncEnumerable<TElement> parent;
 
         private IEnumerator<TElement> enumerator;
-
-        private readonly OrderedAsyncEnumerable<TElement> parent;
         private IAsyncEnumerator<TElement> parentEnumerator;
 
-
         public OrderedAsyncEnumerable(IAsyncEnumerable<TElement> source, Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending, OrderedAsyncEnumerable<TElement> parent)
         {
-            if (source == null) throw new ArgumentNullException(nameof(source));
-            if (keySelector == null) throw new ArgumentNullException(nameof(keySelector));
+            Debug.Assert(source != null);
+            Debug.Assert(keySelector != null);
+            Debug.Assert(comparer != null);
+
             this.source = source;
             this.keySelector = keySelector;
-            this.comparer = comparer ?? Comparer<TKey>.Default;
+            this.comparer = comparer;
             this.descending = descending;
             this.parent = parent;
         }