CodeEvent.Attributes 屬性

取得這個程式碼事件項目的 CodeElements 屬性集合。

命名空間:  EnvDTE80
組件:  EnvDTE80 (在 EnvDTE80.dll 中)

語法

'宣告
ReadOnly Property Attributes As CodeElements
CodeElements Attributes { get; }
property CodeElements^ Attributes {
    CodeElements^ get ();
}
abstract Attributes : CodeElements
function get Attributes () : CodeElements

屬性值

型別:EnvDTE.CodeElements
CodeElements 集合。

範例

下列範例示範如何使用 Attributes 屬性。

若要測試這個屬性:

  1. 將游標放在事件物件上開啟目標專案,並選取程式碼事件項目。

  2. 將屬性附加至程式碼事件項目。

  3. 執行增益集。

public static void Attributes(EnvDTE80.DTE2 dte)
{
    TextSelection objTextSel;
    EnvDTE80.CodeEvent codeEvent;
    objTextSel = (TextSelection)dte.ActiveDocument.Selection;
    codeEvent = (EnvDTE80.CodeEvent)objTextSel.ActivePoint.get_CodeElement(vsCMElement.vsCMElementEvent);

    string str = "";
    foreach (CodeElement ce in codeEvent.Attributes)
        str += "\n" + ce.Name;
    MessageBox.Show("\nAttributes property: " +
                    str, "Testing CodeEvent");
}

.NET Framework 安全性

請參閱

參考

CodeEvent 介面

EnvDTE80 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例

使用程式碼模型探索程式碼 (Visual Basic)

使用程式碼模型探索程式碼 (Visual C#)