Package.AddOptionKey Method
Adds a user option key name into the list of option keys.
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 Sub AddOptionKey ( _
name As String _
)
'使用
Dim name As String
Me.AddOptionKey(name)
protected void AddOptionKey(
string name
)
protected:
void AddOptionKey(
String^ name
)
member AddOptionKey :
name:string -> unit
protected function AddOptionKey(
name : String
)
Parameters
- name
Type: System.String
The name of the option key to add. An option key name must not have any periods in it.
Remarks
The AddOptionKey method adds a user option key name into the list of option keys that the package stores in the solution file. To save package data in a solution file, perform the following tasks:
Call AddOptionKey in your package constructor for each option key you want to store.
Override OnLoadOptions and OnSaveOptions and implement your save and load logic for each key. OnSaveOptions is called for each key you have added. OnLoadOptions is called for each key in the solution file.
.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.