共用方式為


Evaluate Statement Command

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Evaluates and displays the given statement.

Syntax

Debug.EvaluateStatement text

Arguments

text Required. The statement to evaluate.

Remarks

The window used to enter the EvaluateStatement command determines whether an equals sign (=) is interpreted as a comparison operator or as an assignment operator.

In the Command window, an equals sign (=) is interpreted as a comparison operator. So, for example, if the values of variables a and b are different, then the command

>Debug.EvaluateStatement(a=b)

will return a value of false.

In the Immediate window, by contrast, an equals sign (=) is interpreted as an assignment operator. So, for example, the command

>Debug.EvaluateStatement(a=b)

will assign to variable a the value of variable b.

Example

>Debug.EvaluateStatement(a+b)

See Also

Print Command Visual Studio Commands Command Window Find/Command Box Visual Studio Command Aliases