ServiceProviderExtensions.GetService<T> Method

Namespace:  Microsoft.Owin.Hosting.Services
Assembly:  Microsoft.Owin.Hosting (in Microsoft.Owin.Hosting.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function GetService(Of T) ( _
    services As IServiceProvider _
) As T
'Usage
Dim services As IServiceProvider 
Dim returnValue As T

returnValue = services.GetService()
public static T GetService<T>(
    this IServiceProvider services
)
[ExtensionAttribute]
public:
generic<typename T>
static T GetService(
    IServiceProvider^ services
)
static member GetService : 
        services:IServiceProvider -> 'T 
JScript does not support generic types and methods.

Type Parameters

  • T

Parameters

Return Value

Type: T

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IServiceProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.111) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.111).

See Also

Reference

ServiceProviderExtensions Class

Microsoft.Owin.Hosting.Services Namespace