Reputation: 38683
Can any one explain about the difference between IObServer and IObServable in c#?
The documentation for both looks very similar. So, I want to know the scenarios where IObServer<T>
and IObServable<T>
should be used?
Upvotes: 0
Views: 123
Reputation: 2688
From MSDN : https://msdn.microsoft.com/en-us/library/dd783449%28v=vs.110%29.aspx
The IObserver<T>
and IObservable<T>
interfaces provide a generalized mechanism for push-based notification, also known as the observer design pattern.
The
IObservable<T>
interface represents the class that sends notifications (the provider);The
IObserver<T>
interface represents the class that receives them (the observer).
and T represents the class that provides the notification information.
Upvotes: 2
Reputation: 62286
Documentation is clear by itself:
The IObservable interface represents the class that sends notifications (the provider); the IObserver interface represents the class that receives them (the observer). T represents the class that provides the notification information.
So in other words: IObservable
is a one who pushes notifications to the channel, IObserver
the one who ones subscribed, start receiving them.
Upvotes: 0