samedi 16 février 2019

what are the differences between .net observer pattern variations (IObservable and event delegation) and when to use each?

i just want to know when to use each and what the advantages of each i really struggle to understand why .net introduced IObservable/IObserver after having the Event Delegation and according too MSDN Event Delegation is Preferred

Based on our understanding of the Observer pattern, let us now turn our attention to the use of this pattern within the .NET Framework. Those of you with passing familiarity of the types exposed in the FCL will note that no IObserver, IObservable, or ObservableImpl types*are present in the Framework. The primary reason for their absence is the fact that the CLR makes them obsolete after a fashion. Although you can certainly use these constructs in a .NET application, the introduction of *delegates and events provides a new and powerful means of implementing the Observer pattern without developing specific types dedicated to support this pattern. In fact, as delegates and events are first class members of the CLR, the foundation of this pattern is incorporated into the very core of the .NET Framework. As such, the FCL makes extensive use of the Observer pattern throughout its structure.

so why they added IObservable to .net 4.0

Aucun commentaire:

Enregistrer un commentaire