Compartir a través de


Expression.IsValidValue Property

Indicates whether the specified value in an expression is valid.

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

Syntax

'Declaration
ReadOnly Property IsValidValue As Boolean
bool IsValidValue { get; }
property bool IsValidValue {
    bool get ();
}
abstract IsValidValue : bool with get
function get IsValidValue () : boolean

Property Value

Type: System.Boolean
A Boolean value.

Remarks

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

Examples

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.");
}
Shared Sub IsValidValue(ByRef dte As EnvDTE.DTE)
    Dim exp As EnvDTE.Expression = dte.Debugger.GetExpression("tempC", True, 1)
    If exp.IsValidValue Then
        MessageBox.Show("The specified value in an expression is valid.", _
                        "Expression Test - IsValidValue Property")
    Else
        MessageBox.Show("The specified value in an expression is invalid.", _
                        "Expression Test - IsValidValue Property")
    End If
End Sub

.NET Framework Security

See Also

Reference

Expression Interface

EnvDTE Namespace