VCCodeAttribute.Index 属性

定义

获取特性块中特性的位置。

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

属性值

Int32

一个值,该值指示特性块内特性的位置。

属性

示例

此示例假设项目中存在名为的类 AClassWithAttributes ,并且它具有特性块。

' 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  

注解

Index属性是从1开始的。 属性的初始值 Index 为1。 每当成功匹配时,它的值就会发生更改。

适用于