瀏覽代碼

Adding some comment to Select.

Bart De Smet 8 年之前
父節點
當前提交
243d99b61c
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs

+ 5 - 0
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs

@@ -435,6 +435,11 @@ namespace System.Linq
             }
         }
 
+        // NB: LINQ to Objects implements IPartition<TResult> for this. However, it seems incorrect to do so in a trivial
+        //     manner where e.g. TryGetLast simply indexes into the list without running the selector for the first n - 1
+        //     elements in order to ensure side-effects. We should consider whether we want to follow this implementation
+        //     strategy or support IAsyncPartition<TResult> in a less efficient but more correct manner here.
+
         internal sealed class SelectIListIteratorWithTask<TSource, TResult> : AsyncIterator<TResult>, IAsyncIListProvider<TResult>
         {
             private readonly Func<TSource, Task<TResult>> selector;