IServiceProviderEx.GetService Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes an object that specifies the type of service object to get.
Overloads
| GetService<T>() |
Retrieves an object that specifies the type of service object to get. |
| GetService<T>(Boolean) |
Specifies a value that indicates the type of service object to get. |
GetService<T>()
Retrieves an object that specifies the type of service object to get.
public:
generic <typename T>
T GetService();
public T GetService<T> ();
abstract member GetService : unit -> 'T
Public Function GetService(Of T) () As T
Type Parameters
- T
The type of the service object.
Returns
- T
The specified type of service object to get.
Applies to
GetService<T>(Boolean)
Specifies a value that indicates the type of service object to get.
public:
generic <typename T>
T GetService(bool throwIfNotFound);
public T GetService<T> (bool throwIfNotFound);
abstract member GetService : bool -> 'T
Public Function GetService(Of T) (throwIfNotFound As Boolean) As T
Type Parameters
- T
The generic type value.
Parameters
- throwIfNotFound
- Boolean
true if the service is not found; otherwise, false.
Returns
- T
A service object of type serviceType.