Question

I have noticed that many of the examples of the ReactiveUI extension methods are placed in the constructor.

What are the advantages of this over placing in a "SetupObservables" method?

Was it helpful?

Solution

The advantage is that you should really only be calling RxUI methods like WhenAny when the object is created. You want to declare up front what will happen when certain events occur in a Declarative way.

This is a Different Way Of Thinking than any other MVVM framework, you want to describe how things are related as how your object works, and let RxUI itself deal with the updates. The best place to do that is in the constructor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top