CodeAttributeArgument.StartPoint 属性

获取一个 TextPoint 对象,该对象定义代码特性参数的开头。

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

语法

声明
ReadOnly Property StartPoint As TextPoint
TextPoint StartPoint { get; }
property TextPoint^ StartPoint {
    TextPoint^ get ();
}
abstract StartPoint : TextPoint with get
function get StartPoint () : TextPoint

属性值

类型:TextPoint
一个 TextPoint 对象,该对象定义代码特性参数的开头。

备注

备注

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

示例

' Macro code.
Sub codeArgNameExample()
    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

    Try
        ' 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 += "Value: " & attrArg.Value & " " & vbCr
                ' If the argument has a name, list it.
                If attrArg.Name <> Nothing Then
                    msg += "Name: " & attrArg.Name & vbCr
                End If
                msg += "Arg start pos: " & _
                attrArg.StartPoint.LineCharOffset & vbCr
                msg += "Arg end pos: " & _
                attrArg.EndPoint.LineCharOffset & vbCr
            Next
        Next
        msg += "Location: " & attrArg.InfoLocation.ToString & vbCr
        msg += "Is code type? " & attrArg.IsCodeType.ToString & vbCr
        msg += "Code element type: " & attrArg.Kind.ToString & vbCr
        msg += "Language: " & attrArg.Language & vbCr
        msg += ("Name of attribute's project item: " & _
        attrArg.ProjectItem.Name)
        ' List the arguments for the attribute.
        MsgBox("Attribute parameters for " & attr.Name _
        & ": " & vbCr & msg)
    Catch ex As System.Exception
        MsgBox("ERROR -> " & ex.Message)
    End Try
End Sub

.NET Framework 安全性

请参阅

参考

CodeAttributeArgument 接口

EnvDTE80 命名空间

EndPoint

GetEndPoint

GetStartPoint