次の方法で共有


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 プロパティは 1 から始まります。 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 名前空間