Package.Initialize Method
Called when the VSPackage is loaded by Visual Studio.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Syntax
'宣告
Protected Overridable Sub Initialize
'用途
Me.Initialize()
protected virtual void Initialize()
protected:
virtual void Initialize()
abstract Initialize : unit -> unit
override Initialize : unit -> unit
protected function Initialize()
Remarks
Override Initialize when you need to carry out additional steps (such as Editor Factory registration) when the VSPackage is loaded by Visual Studio.
Place any initialization steps that require access to the global service provider (such as Editor Factory registration) in the Initialize method.
In contrast, steps such as adding services, adding option keys, and toolbox event handlers should be placed in the Package constructor method.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.