forked from reactiveui/ReactiveUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisposableMixins.cs
More file actions
27 lines (27 loc) · 888 Bytes
/
DisposableMixins.cs
File metadata and controls
27 lines (27 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace System.Reactive.Disposables
{
public static class DisposableMixins
{
/// <summary>
/// Ensures the provided disposable is disposed with the specified <see cref="CompositeDisposable"/>.
/// </summary>
/// <typeparam name="T">
/// The type of the disposable.
/// </typeparam>
/// <param name="this">
/// The disposable.
/// </param>
/// <param name="compositeDisposable">
/// The <see cref="CompositeDisposable"/> to which <paramref name="this"/> will be added.
/// </param>
/// <returns>
/// The disposable.
/// </returns>
public static T DisposeWith<T>(this T @this, CompositeDisposable compositeDisposable)
where T : IDisposable
{
compositeDisposable.Add(@this);
return @this;
}
}
}