IVsUserContext.AddAttribute Method
Adds an attribute, lookup keyword, or F1 keyword to the context or subcontext bag.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'宣言
Function AddAttribute ( _
usage As VSUSERCONTEXTATTRIBUTEUSAGE, _
szName As String, _
szValue As String _
) As Integer
'使用
Dim instance As IVsUserContext
Dim usage As VSUSERCONTEXTATTRIBUTEUSAGE
Dim szName As String
Dim szValue As String
Dim returnValue As Integer
returnValue = instance.AddAttribute(usage, _
szName, szValue)
int AddAttribute(
VSUSERCONTEXTATTRIBUTEUSAGE usage,
string szName,
string szValue
)
int AddAttribute(
[InAttribute] VSUSERCONTEXTATTRIBUTEUSAGE usage,
[InAttribute] String^ szName,
[InAttribute] String^ szValue
)
function AddAttribute(
usage : VSUSERCONTEXTATTRIBUTEUSAGE,
szName : String,
szValue : String
) : int
Parameters
usage
Type: Microsoft.VisualStudio.Shell.Interop.VSUSERCONTEXTATTRIBUTEUSAGE[in] Type of item (attribute, keyword, or F1 keyword) to add to the context or suncontext bag. For a list of usage values, see VSUSERCONTEXTATTRIBUTEUSAGE.
szName
Type: System.String[in] If you are adding an attribute to the context or subcontext bag, then specify the name of the attribute for this parameter. If you are adding a lookup keyword or an F1 keyword, enter the term "keyword" for this parameter.
szValue
Type: System.String[in] If you are adding an attribute to the context or subcontext bag, then specify the value of the attribute for this parameter. If you are adding a lookup keyword or F1 keyword, enter the actual text of the keyword for this parameter.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From context.idl:
HRESULT IVsUserContext::AddAttribute(
[in] VSUSERCONTEXTATTRIBUTEUSAGE usage,
[in] LPCOLESTR szName, [in] LPCOLESTR szValue
);
The IVsUserContext.AddAttribute method adds an attribute, lookup keyword, or F1 keyword to the context or subcontext bag, without overriding the values already present. Keywords are used by the Dynamic Help window to complete a lookup in the information provider, which returns a list of topics related to the keyword. The Dynamic Help window then uses the attributes in the active context to filter the list returned by the information provider. Any topics with attributes that do not match those in the active context are filtered away and are not shown in the Dynamic Help window. For more information about how attributes and keywords are used with the Dynamic Help window, see Dynamic Help Window Implementation.
To remove one or several attributes, lookup keywords, or F1 keywords from the context bag, use the RemoveAttribute method. Use the RemoveAttributeIncludeChildren method to additionally remove attributes or keywords from the associated subcontext bag or bags.
Permissions
- 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.