using System; using System.Collections.Generic; namespace UniRx { public static class DisposableExtensions { public static T AddTo(this T disposable, ICollection container) where T : IDisposable { if (disposable == null) { throw new ArgumentNullException("disposable"); } if (container == null) { throw new ArgumentNullException("container"); } container.Add(disposable); return disposable; } } }