共用方式為


LanguageService.GetService Method

Returns a service object that can be cast to a specific interface.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'宣告
Public Function GetService ( _
    serviceType As Type _
) As Object
public Object GetService(
    Type serviceType
)

Parameters

  • serviceType
    Type: System.Type
    [in] The GUID of the service to get.

Return Value

Type: System.Object
If successful, returns an object that can be cast to a desired interface; otherwise, returns a null value (the service does not exist or is not available).

Remarks

A service proffers at least one interface and other, related interfaces can be obtained from either the service or another interface.

.NET Framework Security

See Also

Reference

LanguageService Class

Microsoft.VisualStudio.Package Namespace