How can I filter WhenAnyValue values, similar to use of .When() in LINQ?
The story: I am performing filtering inside the subscriber (full code is in my other question):
vm.WhenAnyValue(o => o.Foo, o => o.Foo!.Bar, o => o.Foo!.Baz, o => o.Foo!.Qux,
(foo, bar, baz, qux) => (foo, bar, baz, qux)).Subscribe(o =>
{
if (o.foo != null && (o.bar != o.foo.Bar || o.baz != o.foo.Baz || o.qux != o.foo.Qux))
return;
Console.WriteLine($"{o.foo?.GetHashCode()} {o.foo?.Bar} {o.foo?.Baz} {o.foo?.Qux}");
});
This works, but I'd like to move if check outside of subscriber and do not pass bar, baz and qux into subscriber, because they are unsafe to use (due to null propagation they may contain stale values and I want to force using of foo to reach their values).