Skip to content

M_CodeJam_Services_ServiceProviderHelper_GetRequiredService

andrewvk edited this page Jun 23, 2016 · 5 revisions

ServiceProviderHelper.GetRequiredService Method (IServiceProvider, Type)

Gets the service object of the specified type, or throws an exception if service not registered.

Namespace: CodeJam.Services
Assembly: CodeJam (in CodeJam.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#

public static Object GetRequiredService(
	this IServiceProvider provider,
	Type serviceType
)

VB

<ExtensionAttribute>
Public Shared Function GetRequiredService ( 
	provider As IServiceProvider,
	serviceType As Type
) As Object

F#

[<ExtensionAttribute>]
static member GetRequiredService : 
        provider : IServiceProvider * 
        serviceType : Type -> Object 

Parameters

 

provider
Type: System.IServiceProvider
Instance of IServiceProvider.
serviceType
Type: System.Type
An object that specifies the type of service object to get.

Return Value

Type: Object
A service object of type serviceType.

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 Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

ServiceProviderHelper Class
GetRequiredService Overload
CodeJam.Services Namespace

Clone this wiki locally