Created
February 25, 2018 16:00
-
-
Save codebeaulieu/210c93dec58123cfe8abde6e493b4233 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class IObservableExtensions | |
{ | |
public static TDisposable DisposeWith<TDisposable>(this TDisposable observable, CompositeDisposable disposables) where TDisposable : class, IDisposable | |
{ | |
if (observable != null) | |
disposables?.Add(observable); | |
return observable; | |
} | |
public static TDisposable DisposeWith<TDisposable>(this TDisposable observable, Lazy<CompositeDisposable> disposables) where TDisposable : class, IDisposable | |
{ | |
if (observable != null) | |
disposables?.Value?.Add(observable); | |
return observable; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment