Dela via


ServiceManager.GetService<ServiceType> Method

Retrieves an instance of a service of the specified generic type.

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

Syntax

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

returnValue = instance.GetService()
public ServiceType GetService<ServiceType>()
public:
generic<typename ServiceType>
ServiceType GetService()
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; otherwise, nulla null reference (Nothing in Visual Basic).

Remarks

If nulla null reference (Nothing in Visual Basic) is not acceptable as a return value and an exception is preferred, use GetRequiredService<ServiceType> instead. GetRequiredService<ServiceType> provides a more reliable contract.

.NET Framework Security

See Also

Reference

ServiceManager Class

ServiceManager Members

GetService Overload

Microsoft.Windows.Design Namespace

EditingContext

ContextItem

Other Resources

WPF Designer Extensibility