Container.GetService<T>(String) Method

Definition

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Searches for and returns the specified service.

public:
generic <typename T>
 where T : class virtual T GetService(System::String ^ name);
public T GetService<T> (string name) where T : class;
abstract member GetService : string -> 'T (requires 'T : null)
override this.GetService : string -> 'T (requires 'T : null)
Public Function GetService(Of T As Class) (name As String) As T

Type Parameters

T

The type of the service to search for.

Parameters

name
String

The name of the service to search for.

Returns

T

Type: {0}

The service.

Implements

Exceptions

The name parameter is a null reference (Nothing in Visual Basic) or empty.

The container could not find a component with the specified name.

Applies to