Browse Source

Minor cleanup

Oren Novotny 9 năm trước cách đây
mục cha
commit
34012690a0

+ 10 - 5
Ix.NET/Source/System.Interactive.Async/AsyncEnumerable.cs

@@ -49,8 +49,8 @@ namespace System.Linq
             return CreateEnumerable(
                 () => CreateEnumerator<TValue>(
                     (ct, tcs) => tcs.Task,
-                    () => { throw new InvalidOperationException(); },
-                    () => { })
+                    null,
+                    null)
             );
         }
 
@@ -67,9 +67,14 @@ namespace System.Linq
 
             return CreateEnumerable(
                 () => CreateEnumerator<TValue>(
-                    ct => TaskExt.Throw<bool>(exception),
-                    () => { throw new InvalidOperationException(); },
-                    () => { })
+                    ct =>
+                    {
+                        var tcs = new TaskCompletionSource<bool>();
+                        tcs.TrySetException(exception);
+                        return tcs.Task;
+                    },
+                    null,
+                    null)
             );
         }
 

+ 0 - 1
Ix.NET/Source/System.Interactive.Async/Create.cs

@@ -39,7 +39,6 @@ namespace System.Linq
                     var stop = new Action(
                         () =>
                         {
-                            self.Dispose();
                             tcs.TrySetCanceled();
                         });
 

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

@@ -9,12 +9,5 @@ namespace System.Threading.Tasks
     {
         public static readonly Task<bool> True = Task.FromResult(true);
         public static readonly Task<bool> False = Task.FromResult(false);
-        
-        public static Task<T> Throw<T>(Exception exception)
-        {
-            var tcs = new TaskCompletionSource<T>();
-            tcs.TrySetException(exception);
-            return tcs.Task;
-        }
     }
 }