Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9366

型の違うReactivePropertyをCombineLatestしたい

$
0
0

型の違うReactiveProperty

privateStringReactivePropertysentence=newStringReactiveProperty(string.Empty);privateBoolReactivePropertyflag=newBoolReactiveProperty(false);

どちらかに何かあったときに、両方の値を参照できるようにしたい。

普通にはCombineLatestできない

sentence.CombineLatest(flag).Subscribe((s,f)=>{// ERR}).AddTo(this);

Tupleで合成するといける

sentence.CombineLatest(flag,Tuple.Create).Subscribe(tuple=>{var(sentence,flag)=tuple;// OK}).AddTo(this);

Zip, ZipLatestはいける
Merge, Ambは無理

両方の変数が参照できる位置にあるなら、sentenceflagに同じ処理をSubscribeするのが楽でいいのかも。


Viewing all articles
Browse latest Browse all 9366

Latest Images

Trending Articles