示例#1
0
 /// <summary>
 /// Registers an IDisposable with the <see cref="Disposables"/> instance.
 /// </summary>
 public static T DisposeWith <T>(this T value, Disposables disposables) where T : IDisposable =>
 disposables.Register(value);
示例#2
0
 /// <summary>
 /// Registers an object with the <see cref="Disposables" /> instance with custom disposal logic.
 /// </summary>
 public static T DisposeWith <T>(this T value, Disposables disposables, Action <T> onDispose) =>
 disposables.Register(value.AsDisposable(onDispose));