Condividi tramite


Expression2.DataMembers Property

Definition

If the expression represents a class or a structure, this property gets a list of member variables as an Expressions collection.

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

Property Value

An Expressions collection.

Implements

Attributes

Examples

The following example demonstrates how to use the DataMembers property.

public static void DataMembers(DTE dte)  
{  
    // Setup debug Output window.  
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);  
    w.Visible = true;  
    OutputWindow ow = (OutputWindow)w.Object;  
    OutputWindowPane owp = ow.OutputWindowPanes.Add("DataMembers Property Test");  
    owp.Activate();  

    // "a" is an instance of class A.  
    EnvDTE100.Expression2 exp1 = dte.Debugger.GetExpression("a", true, 1);  
    EnvDTE.Expressions exps = exp1.DataMembers;  
    foreach(EnvDTE100.Expression2 exp in exps)  
        owp.OutputString(exp.Name + "\n");  
}  
Shared Sub DataMembers(ByRef dte As EnvDTE.DTE)  
    Dim exp As EnvDTE100.Expression2 = dte.Debugger.GetExpression("a", True, 1)  
    Dim exps As EnvDTE.Expressions = exp.DataMembers  
    Dim str As String = vbCrLf  
    For Each exp In exps  
        str += vbCrLf + vbTab + exp.Name  
    Next  
    MessageBox.Show("List of class A data members: " + _  
                    str, "Expression Test - Data Members Property")  
End Sub  

Remarks

See Expressions in the Debugger for general information about expressions.

Applies to