Expression.DataMembers Property

Definition

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

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

An Expressions collection.

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.  
    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  
    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