EnlightenmentProvider.cs 1.5 KB

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
  2. using System.Reactive.Concurrency;
  3. namespace System.Reactive.PlatformServices
  4. {
  5. /// <summary>
  6. /// Provides access to the platform enlightenments used by other Rx libraries to improve system performance and
  7. /// runtime efficiency. While Rx can run without platform enlightenments loaded, it's recommended to deploy the
  8. /// System.Reactive.PlatformServices assembly with your application and call <see cref="EnlightenmentProvider.
  9. /// EnsureLoaded"/> during application startup to ensure enlightenments are properly loaded.
  10. /// </summary>
  11. public static class EnlightenmentProvider
  12. {
  13. /// <summary>
  14. /// Ensures that the calling assembly has a reference to the System.Reactive.PlatformServices assembly with
  15. /// platform enlightenments. If no reference is made from the user code, it's possible for the build process
  16. /// to drop the deployment of System.Reactive.PlatformServices, preventing its runtime discovery.
  17. /// </summary>
  18. /// <returns>
  19. /// true if the loaded enlightenment provider matches the provided defined in the current assembly; false
  20. /// otherwise. When a custom enlightenment provider is installed by the host, false will be returned.
  21. /// </returns>
  22. public static bool EnsureLoaded()
  23. {
  24. return PlatformEnlightenmentProvider.Current is CurrentPlatformEnlightenmentProvider;
  25. }
  26. }
  27. }