共用方式為


LanguageService.SetSite Method

Called to set or site the service provider for this language service.

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

Syntax

'Declaration
Public Sub SetSite ( _
    site As Object _
)
public void SetSite(
    Object site
)
public:
virtual void SetSite(
    Object^ site
) sealed
abstract SetSite : 
        site:Object -> unit  
override SetSite : 
        site:Object -> unit
public final function SetSite(
    site : Object
)

Parameters

  • site
    Type: Object

    [in] The object that is to be the parent service provider for this language service. This cannot be a null value!

Implements

IObjectWithSite.SetSite(Object)

Remarks

You can call this method after you instantiate the language service in your implementation of the LanguageService.Initialize method. Typically, the VSPackage is passed as the service provider. When LanguageService.GetService is called, it typically passes the request on the service provider given by LanguageService.SetSite. The object passed in must be derived from VSPackage and implement either the IServiceProvider or IOleServiceProvider interface.

The base method stores the service provider in an internal variable and calls GetProviderLocale on the service provider object (which is why the object must be derived from Microsoft.VisualStudio.Shell.Package).

.NET Framework Security

See Also

Reference

LanguageService Class

Microsoft.VisualStudio.Package Namespace