Compartir a través de


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

'Declaration
Function AddAttribute ( _
    usage As VSUSERCONTEXTATTRIBUTEUSAGE, _
    szName As String, _
    szValue As String _
) As Integer
int AddAttribute(
    VSUSERCONTEXTATTRIBUTEUSAGE usage,
    string szName,
    string szValue
)
int AddAttribute(
    [InAttribute] VSUSERCONTEXTATTRIBUTEUSAGE usage, 
    [InAttribute] String^ szName, 
    [InAttribute] String^ szValue
)
abstract AddAttribute : 
        usage:VSUSERCONTEXTATTRIBUTEUSAGE * 
        szName:string * 
        szValue:string -> int
function AddAttribute(
    usage : VSUSERCONTEXTATTRIBUTEUSAGE, 
    szName : String, 
    szValue : String
) : int

Parameters

  • szName
    Type: 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: 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: 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.

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.

.NET Framework Security

See Also

Reference

IVsUserContext Interface

Microsoft.VisualStudio.Shell.Interop Namespace