IVsUserContext::AddAttribute Method (VSUSERCONTEXTATTRIBUTEUSAGE, String^, String^)
Adds an attribute, lookup keyword, or F1 keyword to the context or subcontext bag.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
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::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
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.
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.