共用方式為


VCCodeAttribute.Index 屬性

取得屬性區塊中屬性的位置。

命名空間:  Microsoft.VisualStudio.VCCodeModel
組件:  Microsoft.VisualStudio.VCCodeModel (在 Microsoft.VisualStudio.VCCodeModel.dll 中)

語法

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

屬性值

類型:Int32
值,表示屬性區塊內屬性的位置。

備註

Index 屬性是以一起始。 Index 屬性的初始值是 1。 它的值變更時,只要比對成功進行。

範例

這個範例假設,名為的 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

.NET Framework 安全性

請參閱

參考

VCCodeAttribute 介面

Microsoft.VisualStudio.VCCodeModel 命名空間