Expression.DataMembers Property


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

[get: System.Runtime.InteropServices.DispId(101)]
public EnvDTE.Expressions DataMembers { get; }
Property Value

An Expressions collection.


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

    // "a" is an instance of class A.  
    EnvDTE.Expression exp1 = dte.Debugger.GetExpression("a", true, 1);  
    EnvDTE.Expressions exps = exp1.DataMembers;  
    foreach(EnvDTE.Expression exp in exps)  
        owp.OutputString(exp.Name + "
"); }
Shared Sub DataMembers(ByRef dte As EnvDTE.DTE)  
    Dim exp As EnvDTE.Expression = 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  
    MessageBox.Show("List of class A data members: " + _  
                    str, "Expression Test - Data Members Property")  
End Sub  


See Expressions in the Debugger for general information about expressions.

Applies to