2

I have two IObservable<bool> ( canEdit1 and canEdit2 ), how can I unite them?

Here is a sample of my code:

var canEdit1 = InerrProperty1.WhenAnyValue(x => x.Property1, x => x,
                (prop1, x) => prop1 != null &&  x != null);
var canEdit2 = InerrProperty2.WhenAnyValue(x=> x.Property1, x=>x.Property2, 
    (prop1,prop2) => !string.IsNullOrEmpty(prop1) && !string.IsNullOrEmpty(prop2));
MEDZ
  • 2,227
  • 2
  • 14
  • 18
AllexVO
  • 29
  • 1
  • 1
    What do you mean "unite" ? Can you provide few examples of what should happen with different values in different sequence? – Euphoric Dec 10 '19 at 15:55
  • @HereticMonkey This seems to be a ReactiveUI question. Can't use the RxJS solution. – Asti Dec 11 '19 at 21:06

2 Answers2

2

You can use the Merge functionality. It should look something like this:

var merged = canEdit1.Merge(canEdit2);

You can later subscribe to it, or do additional operators on it.

Lazar Nikolov
  • 928
  • 14
  • 21
0

With the system.reactive library, there are multiple ways for combining observables. Has explained here, none implements a topological ordered query resolution. In a cases like diamond dependency graph, none of them will avoid intermediate/incoherent states.

diamond dependency graph: A -> Input, B -> Input, Output -> A, Output ->B

Storm.Net (Simple Topologically Ordered Reactive Model) his an attempt to provide a data model that propagates update in a topological order.

Orace
  • 7,822
  • 30
  • 45