using Microsoft.Extensions.DependencyInjection; namespace ODMO.Game { public static class SingletonResolver { public static IServiceProvider Services { get; set; } public static T GetService() where T : notnull { return Services.GetRequiredService(); } // Function to retrieve all registered services public static List GetAllRegisteredServices() { var serviceDescriptors = Services.GetService(); if (serviceDescriptors == null) throw new InvalidOperationException("ServiceCollection is not available in the current context."); return serviceDescriptors.Select(descriptor => descriptor.ServiceType).ToList(); } } }