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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Windows.Design Namespace