Поделиться через


ServiceManager.GetService<TServiceType> Method

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

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

Syntax

'Declaration
Public Function GetService(Of TServiceType) As TServiceType
public TServiceType GetService<TServiceType>()
public:
generic<typename TServiceType>
TServiceType GetService()
member GetService : unit -> 'TServiceType 
JScript does not support generic types or methods.

Type Parameters

  • TServiceType

Return Value

Type: TServiceType
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<TServiceType> instead. GetRequiredService<TServiceType> provides a more reliable contract.

.NET Framework Security

See Also

Reference

ServiceManager Class

GetService Overload

Microsoft.Windows.Design Namespace

EditingContext

ContextItem

Other Resources

WPF Designer Extensibility