DefaultDisposable.cs 799 B

1234567891011121314151617181920212223242526272829
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Reactive.Disposables
  5. {
  6. /// <summary>
  7. /// Represents a disposable that does nothing on disposal.
  8. /// </summary>
  9. internal sealed class DefaultDisposable : IDisposable
  10. {
  11. /// <summary>
  12. /// Singleton default disposable.
  13. /// </summary>
  14. public static readonly DefaultDisposable Instance = new DefaultDisposable();
  15. private DefaultDisposable()
  16. {
  17. }
  18. /// <summary>
  19. /// Does nothing.
  20. /// </summary>
  21. public void Dispose()
  22. {
  23. // no op
  24. }
  25. }
  26. }