// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace System.Reactive.Disposables
{
    /// 
    /// Provides a set of static methods for creating Disposables.
    /// 
    public static class Disposable
    {
        /// 
        /// Gets the disposable that does nothing when disposed.
        /// 
        public static IDisposable Empty
        {
            get { return DefaultDisposable.Instance; }
        }
        /// 
        /// Creates a disposable object that invokes the specified action when disposed.
        /// 
        /// Action to run during the first call to . The action is guaranteed to be run at most once.
        /// The disposable object that runs the given action upon disposal.
        ///  is null.
        public static IDisposable Create(Action dispose)
        {
            if (dispose == null)
                throw new ArgumentNullException("dispose");
            return new AnonymousDisposable(dispose);
        }
    }
}