/// <summary>
        /// Disposes the list of supplied <paramref name="disposables"/>. The list is iterated in reverse
        /// order (the first element in the list will be disposed last) and the method ensures that the
        /// Dispose method of each element is called, regardless of any exceptions raised from any previously
        /// called Dispose methods. If multiple exceptions are thrown, the last thrown exception will bubble
        /// up the call stack.
        /// </summary>
        /// <param name="disposables">The list of objects to be disposed.</param>
        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="disposables"/> is a null
        /// reference.</exception>
        protected internal static void DisposeInstances(IList <IDisposable> disposables)
        {
            // NOTE: This method is included for backwards compatibility :-(. It was added in 2.4.0.
            Requires.IsNotNull(disposables, "disposables");

            Helpers.DisposeInstancesInReverseOrder(disposables.ToList());
        }
        private void DisposeAllRegisteredDisposables()
        {
            if (this.disposables != null)
            {
                var instances = this.disposables;

                this.disposables = null;

                Helpers.DisposeInstancesInReverseOrder(instances);
            }
        }