Export (0) Print
Expand All

Expression.IsValidValue Property

Indicates whether the specified value in an expression is valid.

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

bool IsValidValue { get; }

Property Value

Type: System.Boolean
A Boolean value.

Returns true if the value in the expression is valid; otherwise, it returns false.

The following example demonstrates how to use the IsValidValue property.

To test this property:

  1. Set a breakpoint in your target application.

  2. Run the target application in the debug mode.

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

public static void IsValidValue(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("IsValidValue property: ");
    owp.Activate();

    EnvDTE.Expression exp = dte.Debugger.GetExpression("tempC", true, 1);
    if(exp.IsValidValue)
        owp.OutputString("The specified value in an expression is valid.");
    else
        owp.OutputString("The specified value in an expression is invalid.");
}

Show:
© 2015 Microsoft