Share via


VCCodeAttribute.Index Property

Definition

Gets the position of an attribute in the attribute block.

public:
 property int Index { int get(); };
public:
 property int Index { int get(); };
[System.Runtime.InteropServices.DispId(578)]
public int Index { [System.Runtime.InteropServices.DispId(578)] get; }
[<System.Runtime.InteropServices.DispId(578)>]
[<get: System.Runtime.InteropServices.DispId(578)>]
member this.Index : int
Public ReadOnly Property Index As Integer

Property Value

A value indicating the position of an attribute within the attribute block.

Attributes

Examples

This example assumes that a class named AClassWithAttributes exists in the project and that it has an attribute block.

' 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  

Remarks

The Index property is one-based. The initial value of the Index property is 1. Its value changes whenever a successful match is made.

Applies to