Condividi tramite


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

'Dichiarazione
Function AddAttribute ( _
    usage As VSUSERCONTEXTATTRIBUTEUSAGE, _
    szName As String, _
    szValue As String _
) As Integer
'Utilizzo
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
)
abstract AddAttribute : 
        usage:VSUSERCONTEXTATTRIBUTEUSAGE * 
        szName:string * 
        szValue:string -> int 
function AddAttribute(
    usage : VSUSERCONTEXTATTRIBUTEUSAGE, 
    szName : String, 
    szValue : String
) : int

Parameters

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

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

IVsUserContext Members

Microsoft.VisualStudio.Shell.Interop Namespace