using System; namespace Microsoft.AspNet.CoreServices { public static class ServiceProviderExtensions { /// /// Retrieve a service of type T from the IServiceProvider. /// /// /// /// public static T GetService(this IServiceProvider services) { if (services == null) { throw new ArgumentNullException("services"); } return (T)services.GetService(typeof(T)); } } }