DependencyResolverExtensions.GetService<TService> Method

Resolves singly registered services that support arbitrary object creation.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

public static TService GetService<TService>(
	this IDependencyResolver resolver

Type Parameters


The type of the requested service or object.


Type: System.Web.Mvc.IDependencyResolver

The dependency resolver instance that this method extends.

Return Value

Type: TService
The requested service or object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDependencyResolver. When you use instance method syntax to call this method, omit the first parameter. For more information, see or

For more information about this method, see the entry ASP.NET MVC 3 Service Location on Brad Wilson's blog.