Condividi tramite


IComponentModel.GetService<T> Method

Gets a service from the default composition container, i.e. an object of which there can only a single instance exist in a given composition container. This is the same as calling GetExportedValue``1 directly.

Namespace:  Microsoft.VisualStudio.ComponentModelHost
Assembly:  Microsoft.VisualStudio.ComponentModelHost (in Microsoft.VisualStudio.ComponentModelHost.dll)

Syntax

'Declaration
Function GetService(Of T As Class) As T
T GetService<T>()
where T : class
generic<typename T>
where T : ref class
T GetService()
abstract GetService : unit -> 'T  when 'T : not struct
JScript does not support generic types or methods.

Type Parameters

  • T
    The type of object.

Return Value

Type: T
The instance of the requested object.

.NET Framework Security

See Also

Reference

IComponentModel Interface

Microsoft.VisualStudio.ComponentModelHost Namespace