共用方式為


ServiceProvider.CreateFromSetSite Method

Create a new ServiceProvider for the given site.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)

Syntax

'宣告
Public Shared Function CreateFromSetSite ( _
    sp As IServiceProvider _
) As ServiceProvider
public static ServiceProvider CreateFromSetSite(
    IServiceProvider sp
)

Parameters

Return Value

Type: Microsoft.VisualStudio.Shell.ServiceProvider
The service provider.

Remarks

This method should be called from an object that implements SetSite() (for example, IObjectWithSite or IVsPackage). It sets the global service provider if it hasn't already been set.

This method is typically called from the SetSite() method of a VSPackage.

注意

By calling this method, the caller declares that it knows the global OLE service provider for the calling thread and that the service provider instance returned may be used by other, unrelated components, accessed via the GlobalProvider static property.

.NET Framework Security

See Also

Reference

ServiceProvider Class

Microsoft.VisualStudio.Shell Namespace