Oren Novotny 9 лет назад
Родитель
Сommit
c94cff833e
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      Ix.NET/Source/System.Interactive.Async/Cast.cs

+ 7 - 0
Ix.NET/Source/System.Interactive.Async/Cast.cs

@@ -16,6 +16,13 @@ namespace System.Linq
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
 
+            // Check to see if it already is and short-circuit
+            var typedSource = source as IAsyncEnumerable<TResult>;
+            if (typedSource != null)
+            {
+                return typedSource;
+            }
+
             return source.Select(x => (TResult)x);
         }