Share via


Expression2.DataMembers Property

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

Namespace:  EnvDTE100
Assembly:  EnvDTE100 (in EnvDTE100.dll)

Syntax

'Declaration
ReadOnly Property DataMembers As Expressions
Expressions DataMembers { get; }
property Expressions^ DataMembers {
    Expressions^ get ();
}
abstract DataMembers : Expressions with get
function get DataMembers () : Expressions

Property Value

Type: EnvDTE.Expressions
An Expressions collection.

Remarks

See Expressions in the Debugger for general information about expressions.

Examples

The following example demonstrates how to use the DataMembers property.

To test this property:

  1. The target application must contain a class A. The function Main must create an instance of a class A called "a".

  2. Set a breakpoint in the function Main after an instance of class A is created and its member variables are initialized.

  3. Run the target application in the debug mode.

  4. When the application stops at the breakpoint, run the add-in.

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

.NET Framework Security

See Also

Reference

Expression2 Interface

EnvDTE100 Namespace