CurrentPlatformEnlightenmentProvider
(Infrastructure) Provider for platform-specific framework enlightenments.
            
                using System.ComponentModel;
using System.Diagnostics;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace System.Reactive.PlatformServices
{
    [EditorBrowsable(EditorBrowsableState.Never)]
    public class CurrentPlatformEnlightenmentProvider : IPlatformEnlightenmentProvider
    {
        [System.Runtime.CompilerServices.NullableContext(1)]
        [return: System.Runtime.CompilerServices.Nullable(2)]
        public virtual T GetService<T>(object[] args) where T : class
        {
            Type typeFromHandle = typeof(T);
            if (typeFromHandle == typeof(IExceptionServices))
                return (T)(object)new ExceptionServicesImpl();
            if (typeFromHandle == typeof(IConcurrencyAbstractionLayer))
                return (T)(object)new ConcurrencyAbstractionLayerImpl();
            if (typeFromHandle == typeof(IScheduler) && args != null) {
                switch ((string)args[0]) {
                case "ThreadPool":
                    return (T)(object)ThreadPoolScheduler.Instance;
                case "TaskPool":
                    return (T)(object)TaskPoolScheduler.Default;
                case "NewThread":
                    return (T)(object)NewThreadScheduler.Default;
                }
            }
            if (typeFromHandle == typeof(IHostLifecycleNotifications))
                return (T)(object)new HostLifecycleNotifications();
            if (typeFromHandle == typeof(IQueryServices) && Debugger.IsAttached) {
                AssemblyName assemblyName = new AssemblyName(typeFromHandle.GetTypeInfo().Assembly.FullName) {
                    Name = "System.Reactive"
                };
                Type type = Type.GetType("System.Reactive.Linq.QueryDebugger, " + assemblyName.FullName, false);
                if (type != (Type)null)
                    return (T)Activator.CreateInstance(type);
            }
            return null;
        }
    }
}