Skip to content

How to cast inside WhenAnyValue expression? #3727

Answered by anaisbetts
sinatrocious asked this question in Q&A
Discussion options

You must be logged in to vote

Not particularly elegant but if you really have to do the cast:

this.WhenAnyValue(x => x.Foo)
  .Select(x => x != null ? ((Bar)x).WhenAnyValue(y => y => Property) : Observable.Empty())
  .Switch();

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@glennawatson
Comment options

@sinatrocious
Comment options

@anaisbetts
Comment options

Answer selected by sinatrocious
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants