Compartilhar via


IVsUserContext.AddAttribute Method

Definition

Adds an attribute, lookup keyword, or F1 keyword to the context or subcontext bag.

public:
 int AddAttribute(Microsoft::VisualStudio::Shell::Interop::VSUSERCONTEXTATTRIBUTEUSAGE usage, System::String ^ szName, System::String ^ szValue);
public:
 int AddAttribute(Microsoft::VisualStudio::Shell::Interop::VSUSERCONTEXTATTRIBUTEUSAGE usage, Platform::String ^ szName, Platform::String ^ szValue);
int AddAttribute(Microsoft::VisualStudio::Shell::Interop::VSUSERCONTEXTATTRIBUTEUSAGE usage, std::wstring const & szName, std::wstring const & szValue);
public int AddAttribute (Microsoft.VisualStudio.Shell.Interop.VSUSERCONTEXTATTRIBUTEUSAGE usage, string szName, string szValue);
abstract member AddAttribute : Microsoft.VisualStudio.Shell.Interop.VSUSERCONTEXTATTRIBUTEUSAGE * string * string -> int
Public Function AddAttribute (usage As VSUSERCONTEXTATTRIBUTEUSAGE, szName As String, szValue As String) As Integer

Parameters

usage
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
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
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.

Returns

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.

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.

Applies to