// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. using System.ComponentModel; using System.Reflection; namespace System.Reactive.PlatformServices { /// /// (Infrastructure) Interface for enlightenment providers. /// /// /// This type is used by the Rx infrastructure and not meant for public consumption or implementation. /// No guarantees are made about forward compatibility of the type's functionality and its usage. /// [EditorBrowsable(EditorBrowsableState.Never)] public interface IPlatformEnlightenmentProvider { /// /// (Infastructure) Tries to gets the specified service. /// /// Service type. /// Optional set of arguments. /// Service instance or null if not found. T GetService(params object[] args) where T : class; } /// /// (Infrastructure) Provider for platform-specific framework enlightenments. /// /// /// This type is used by the Rx infrastructure and not meant for public consumption or implementation. /// [EditorBrowsable(EditorBrowsableState.Never)] public static class PlatformEnlightenmentProvider { private static IPlatformEnlightenmentProvider s_current = CreatePlatformProvider(); /// /// (Infrastructure) Gets the current enlightenment provider. If none is loaded yet, accessing this property triggers provider resolution. /// /// /// This member is used by the Rx infrastructure and not meant for public consumption or implementation. /// [Obsolete("This mechanism will be removed in the next major version", false)] public static IPlatformEnlightenmentProvider Current { get { return s_current; } set { if (value == null) throw new ArgumentNullException(nameof(value)); s_current = value; } } private static IPlatformEnlightenmentProvider CreatePlatformProvider() { return new CurrentPlatformEnlightenmentProvider(); } } }