返回指定的属性或关键字根据索引位置、名称或优先级别的上下文或 subcontext 包。
命名空间: Microsoft.VisualStudio.Shell.Interop
程序集: Microsoft.VisualStudio.Shell.Interop(在 Microsoft.VisualStudio.Shell.Interop.dll 中)
语法
声明
Function GetAttributePri ( _
iAttribute As Integer, _
pszName As String, _
fIncludeChildren As Integer, _
<OutAttribute> ByRef piPriority As Integer, _
<OutAttribute> ByRef pbstrName As String, _
<OutAttribute> ByRef pbstrValue As String _
) As Integer
int GetAttributePri(
int iAttribute,
string pszName,
int fIncludeChildren,
out int piPriority,
out string pbstrName,
out string pbstrValue
)
参数
- iAttribute
类型:System.Int32
[in] 索引到属性和关键字中的集合在上下文或 subcontext 包。
- pszName
类型:System.String
[in] 属性名称或关键字。指定属性名称来访问该特定属性在上下文或 subcontext 包。指定关键字访问 F1 或查找关键字。
- fIncludeChildren
类型:System.Int32
[in] 如果 true, subcontext 元素与上下文关联的包还然后返回。如果 true, subcontext 然后被排除。
- piPriority
类型:System.Int32%
[out] 属性或关键字的优先级。有关 piPriority 值列表,请参见 VSUSERCONTEXTPRIORITY。
- pbstrName
类型:System.String%
[out] 对特定的属性名称或值关键字的指针,因此,如果找到匹配。
- pbstrValue
类型:System.String%
[out, retval] 对特定属性值或关键字文本的指针,因此,如果找到匹配。
返回值
类型:System.Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。
备注
COM 签名
从 context.idl:
HRESULT IVsUserContext::GetAttributePri(
[in] int iAttribute,
[in] LPCOLESTR pszName,
[in] BOOL fIncludeChildren,
[out] int *piPriority,
[out] BSTR * pbstrName,
[out, retval] BSTR * pbstrValue
);
此方法非常相似。 GetAttribute 方法,但是,附加属性返回或关键字的优先级在上下文或 subcontext 包。有三种不同的方式使用 IVsUserContext.GetAttributePri 方法:
使用 iAttribute 参数,通过在 pszName 参数的值 nullnull 引用(在 Visual Basic 中为 Nothing) 并将所有属性和关键字循环访问上下文或 subcontext 包。使用 CountAttributes 方法,可确定计数属性和关键字。
通过所有属性和关键字重复并传入特定属性名称或关键字 pszName 参数的值。特性名和值或关键字和值。 pbstrName 和 pbstrValue 参数返回,分别,因此,只有当提供的名称与了上下文或 subcontext 包的名称。
通过按值为 -1 iAttribute 参数的和一个特定的属性名称或关键字 pszName 参数的值。与该名称的第一个属性或关键字返回。
如果此方法可查找 pszName 参数匹配,则返回 S_OK。如果方法未找到匹配项,则返回 E_UNEXPECTED。因此,设置 piPriority、 pbstrName 和 pbstrValue 参数的值传递给 nullnull 引用(在 Visual Basic 中为 Nothing) 和计算基于方法返回值的成功或失败是可能的。
使用 GetAttrUsage 方法确定从 IVsUserContext.GetAttributePri 方法返回的关键字是否 F1 或查找关键字。
![]() |
---|
,如果上下文包没有任何 subcontext, fIncludeChildren 参数的值不起作用。 |
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。