using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Torch.API.Managers { public interface IDependencyProvider { /// /// Gets the manager that provides the given type. If there is no such manager, returns null. /// /// Type of manager /// manager, or null if none exists IManager GetManager(Type type); } public static class DependencyProviderExtensions { /// /// Gets the manager that provides the given type. If there is no such manager, returns null. /// /// Type of manager /// manager, or null if none exists public static T GetManager(this IDependencyProvider depProvider) where T : class, IManager { return (T)depProvider.GetManager(typeof(T)); } } }