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
- 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