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

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