LoginSignup
0
2

More than 5 years have passed since last update.

ReactivePropertyで値変更時に古い値をDisposeする

Last updated at Posted at 2017-12-06

まだ、ReactiveExtention を使い始めて三日目の ReactiveProperty 初学者です。

ReactiveProperty で値が変更されるのは良いのだけど、古い値を Dispose してくれなかったので。

//  値の変更時に古い値を Dispose する
var d = this.RxProp.Zip(this.RxProp.Skip(1), (old, _) => old)
    .Subscribe(old => (old as IDisposable)?.Dispose());

//  これは別件
d.AddTo(this.Disposer);

参考

neue cc - Reactive Extensionsで前後の値を利用する

0
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2