Freigeben über


VCCodeAttribute.Index-Eigenschaft

Ruft die Position eines Attributs im Attributblock ab.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

Syntax

'Declaration
ReadOnly Property Index As Integer
int Index { get; }
property int Index {
    int get ();
}
abstract Index : int with get
function get Index () : int

Eigenschaftswert

Typ: Int32
Ein Wert, der die Position eines Attributs im Attributblock angibt.

Hinweise

Die Eigenschaft Index ist einsbasiert. Der Anfangswert der Index-Eigenschaft ist 1. Die Wert, wenn eine erfolgreiche Übereinstimmung gefunden wurde.

Beispiele

Dieses Beispiel setzt voraus, dass eine Klasse, die AClassWithAttributes genannt wird, im Projekt vorhanden ist und dass es einen Attributblock hat.

' Macro code.
Sub ReturnAllAttributes()
        Dim cm As VCCodeModel
        cm = DTE.Solution.Item(1).CodeModel
        Dim cl As VCCodeClass
        cl = cm.Classes.Item("AClassWithAttributes")
        Dim att As VCCodeAttribute
        For Each att In cl.Attributes
            MsgBox(att.Name + " " + att.Index.ToString())
        Next
End Sub

.NET Framework-Sicherheit

Siehe auch

Referenz

VCCodeAttribute Schnittstelle

Microsoft.VisualStudio.VCCodeModel-Namespace