共用方式為


LanguageService.SetSite(Object) Method

Definition

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

public:
 virtual void SetSite(System::Object ^ site);
public:
 void SetSite(Platform::Object ^ site);
void SetSite(winrt::Windows::Foundation::IInspectable const & site);
public void SetSite (object site);
abstract member SetSite : obj -> unit
override this.SetSite : obj -> unit
Public Sub SetSite (site As Object)

Parameters

site
Object

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

Implements

Remarks

You can call this method after you instantiate the language service in your implementation of the Microsoft.VisualStudio.Package.LanguageService.Initialize method. Typically, the VSPackage is passed as the service provider. When Microsoft.VisualStudio.Package.LanguageService.GetService is called, it typically passes the request on the service provider given by Microsoft.VisualStudio.Package.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).

Applies to