Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
- 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