CodeEvent.Attributes 属性

定义

获取 CodeElements 此代码事件元素的特性集合。

public:
 property EnvDTE::CodeElements ^ Attributes { EnvDTE::CodeElements ^ get(); };
[System.Runtime.InteropServices.DispId(33)]
public EnvDTE.CodeElements Attributes { [System.Runtime.InteropServices.DispId(33)] get; }
[<System.Runtime.InteropServices.DispId(33)>]
[<get: System.Runtime.InteropServices.DispId(33)>]
member this.Attributes : EnvDTE.CodeElements
Public ReadOnly Property Attributes As CodeElements

属性值

CodeElements

一个 CodeElements 集合。

属性

示例

下面的示例演示如何使用 Attributes 属性。

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");  
}  

适用于