This documentation is archived and is not being maintained.

Index Property

Visual Studio .NET 2003

Returns the position of an attribute in the attribute block or a parameter in a parameter list.

[Visual Basic .NET]
Public ReadOnly Property Index() As Integer
[Visual Basic 6]
Property Get Index() As Long
HRESULT __stdcall get_Index(
   /* [out, retval] */ long* retVal
public int Index {get;}
[JScript .NET]
public function get Index() : int


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


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

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())
End Sub

See Also

Applies To: VCCodeAttribute Object | VCCodeParameter Object