瀏覽代碼

Renaming observers in ForEach.

Bart De Smet 8 年之前
父節點
當前提交
269b2b2a95

+ 7 - 13
Rx.NET/Source/src/System.Reactive/Linq/Observable/ForEach.cs

@@ -8,7 +8,7 @@ namespace System.Reactive.Linq.ObservableImpl
 {
     internal sealed class ForEach<TSource>
     {
-        public class _ : IObserver<TSource>
+        public sealed class Observer : IObserver<TSource>
         {
             private readonly Action<TSource> _onNext;
             private readonly Action _done;
@@ -16,7 +16,7 @@ namespace System.Reactive.Linq.ObservableImpl
             private Exception _exception;
             private int _stopped;
 
-            public _(Action<TSource> onNext, Action done)
+            public Observer(Action<TSource> onNext, Action done)
             {
                 _onNext = onNext;
                 _done = done;
@@ -24,10 +24,7 @@ namespace System.Reactive.Linq.ObservableImpl
                 _stopped = 0;
             }
 
-            public Exception Error
-            {
-                get { return _exception; }
-            }
+            public Exception Error => _exception;
 
             public void OnNext(TSource value)
             {
@@ -62,7 +59,7 @@ namespace System.Reactive.Linq.ObservableImpl
             }
         }
 
-        public class ForEachImpl : IObserver<TSource>
+        public sealed class ObserverIndexed : IObserver<TSource>
         {
             private readonly Action<TSource, int> _onNext;
             private readonly Action _done;
@@ -71,19 +68,16 @@ namespace System.Reactive.Linq.ObservableImpl
             private Exception _exception;
             private int _stopped;
 
-            public ForEachImpl(Action<TSource, int> onNext, Action done)
+            public ObserverIndexed(Action<TSource, int> onNext, Action done)
             {
                 _onNext = onNext;
                 _done = done;
-                
+
                 _index = 0;
                 _stopped = 0;
             }
 
-            public Exception Error
-            {
-                get { return _exception; }
-            }
+            public Exception Error => _exception;
 
             public void OnNext(TSource value)
             {

+ 2 - 2
Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Blocking.cs

@@ -118,7 +118,7 @@ namespace System.Reactive.Linq
         {
             using (var evt = new WaitAndSetOnce())
             {
-                var sink = new ForEach<TSource>._(onNext, () => evt.Set());
+                var sink = new ForEach<TSource>.Observer(onNext, () => evt.Set());
 
                 using (source.SubscribeSafe(sink))
                 {
@@ -133,7 +133,7 @@ namespace System.Reactive.Linq
         {
             using (var evt = new WaitAndSetOnce())
             {
-                var sink = new ForEach<TSource>.ForEachImpl(onNext, () => evt.Set());
+                var sink = new ForEach<TSource>.ObserverIndexed(onNext, () => evt.Set());
 
                 using (source.SubscribeSafe(sink))
                 {