ServiceManager.GetRequiredService<ServiceType> Method

Retrieves an instance of a service of the specified type.

Namespace:  Microsoft.Windows.Design
Assembly:  Microsoft.Windows.Design (in Microsoft.Windows.Design.dll)

Syntax

'Declaration
Public Function GetRequiredService(Of ServiceType) As ServiceType
'Usage
Dim instance As ServiceManager 
Dim returnValue As ServiceType

returnValue = instance.GetRequiredService()
public ServiceType GetRequiredService<ServiceType>()
public:
generic<typename ServiceType>
ServiceType GetRequiredService()
JScript does not support generic types or methods.

Type Parameters

  • ServiceType
    The type of service to retrieve.

Return Value

Type: ServiceType
An instance of the type of service requested. This method never returns nulla null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
NotSupportedException

There is no service of the type requested.

Remarks

GetRequiredService<ServiceType> throws a NotSupportedException if a service of the type requested is not available. If nulla null reference (Nothing in Visual Basic) is acceptable as a return value in place of an exception, use GetService instead. GetRequiredService<ServiceType> provides a more reliable contract.

.NET Framework Security

See Also

Reference

ServiceManager Class

ServiceManager Members

Microsoft.Windows.Design Namespace

EditingContext

ContextItem

Other Resources

WPF Designer Extensibility