Compartilhar via


Propriedade CodeAttributeArgument.Kind

Obtém um valor de enumeração que define o tipo de elemento de código.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (em EnvDTE80.dll)

Sintaxe

'Declaração
ReadOnly Property Kind As vsCMElement
vsCMElement Kind { get; }
property vsCMElement Kind {
    vsCMElement get ();
}
abstract Kind : vsCMElement with get
function get Kind () : vsCMElement

Valor de propriedade

Tipo: vsCMElement
Um valor vsCMElement.

Comentários

Dica

Os valores de elementos de modelo de código, como classes, estruturas, funções, atributos, delegados e assim por diante podem ser não-determinísticos depois de fazer determinados tipos de edições, o que significa que seus valores não confie sempre permanecer o mesmo.Para obter mais informações, consulte a seção valores de elemento de modelo de código podem ser alterada de Descobrindo código usando o modelo de código (Visual Basic).

Exemplos

' 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

Segurança do .NET Framework

Consulte também

Referência

CodeAttributeArgument Interface

Namespace EnvDTE80

Outros recursos

Como compilar e executar os exemplos de código do modelo de objeto Automation

Descobrindo código usando o modelo de código (Visual Basic)

Descobrindo código usando o modelo de código (Visual C#)