Share via


CodeAttributeArgument 接口

表示代码特性中的单一参数(名称/值对)。

命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)

语法

声明
<GuidAttribute("80F4779B-835D-4873-8356-2F34A759A514")> _
Public Interface CodeAttributeArgument
[GuidAttribute("80F4779B-835D-4873-8356-2F34A759A514")]
public interface CodeAttributeArgument
[GuidAttribute(L"80F4779B-835D-4873-8356-2F34A759A514")]
public interface class CodeAttributeArgument
[<GuidAttribute("80F4779B-835D-4873-8356-2F34A759A514")>]
type CodeAttributeArgument =  interface end
public interface CodeAttributeArgument

CodeAttributeArgument 类型公开以下成员。

属性

  名称 说明
公共属性 Children 获取指定的代码特性参数的子特性的集合。
公共属性 Collection 返回包含支持此属性的对象的集合。
公共属性 DTE 获取顶级扩展性对象,在本例中为 DTE2 对象。
公共属性 EndPoint 获取一个 TextPoint 对象,该对象定义代码特性参数的结束位置。
公共属性 Extender 返回代码特性参数的 Extender。
公共属性 ExtenderCATID 获取代码特性参数的 Extender 的类别 ID (CATID)。
公共属性 ExtenderNames 获取代码特性参数的 Extender 名称。
公共属性 FullName 获取代码特性参数定义的完全限定名。
公共属性 InfoLocation 获取一个表示代码特性参数位置的常数。
公共属性 IsCodeType 获取一个值,该值指示是否可以从该代码特性参数中获取 CodeType 对象。
公共属性 Kind 获取一个枚举值,该值定义代码元素的类型。
公共属性 Language 获取用于创作代码的编程语言。
公共属性 Name 获取或设置代表对象名称的字符串。
公共属性 ProjectItem 获取关联的 ProjectItem 对象。
公共属性 StartPoint 获取一个 TextPoint 对象,该对象定义代码特性参数的开头。
公共属性 Value 设置或获取特性参数的值。

页首

方法

  名称 说明
公共方法 Delete 从代码特性中移除一个参数。
公共方法 GetEndPoint 返回一个 TextPoint 对象,该对象标记特性参数的结束位置。
公共方法 GetStartPoint 获取一个 TextPoint 对象,该对象标记特性参数的开头。

页首

备注

代码特性的所有参数包含在 Collection 属性中。

备注

在进行某些类型的编辑之后,代码模型元素(如类、结构、函数、特性、委托等)的值可能是非确定性的,这意味着不能指望它们的值总是保持不变。有关更多信息,请参见 使用代码模型查找代码 (Visual Basic) 中的“代码模型元素的值可能会更改”一节。

示例

' Macro code.
Sub codeArgExample()
    Dim sel As TextSelection = _
    CType(DTE.ActiveDocument.Selection, TextSelection)
    Dim cls As CodeClass2 = CType(sel.ActivePoint. _
    CodeElement(vsCMElement.vsCMElementClass), CodeClass2)
    Dim attr As CodeAttribute2
    Dim attrArg As CodeAttributeArgument
    Dim msg As String

    ' Loop through all of the attributes in the class.
    For Each attr In cls.Attributes
        ' Loop through all of the arguments for the attribute.
        For Each attrArg In attr.Arguments
            msg += attrArg.Value & " "
        Next
    Next
    ' List the arguments for the attribute.
    MsgBox("Attribute parameters for " & attr.Name _
    & ": " & msg)
End Sub

请参阅

参考

EnvDTE80 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例

使用代码模型查找代码 (Visual Basic)

使用代码模型查找代码 (Visual C#)