164Microsoft Visual Studio 2010: A Beginner’s Guide

Figure 6-13 The Quick Watch window

the Quick Watch window will show that expression. Figure 6-13 shows the Quick Watch window in use.

Clicking the Reevaluate button, shown in Figure 6-13, will show the results of evaluation in the Value area. The Value area will only hold the current expression. If you want to save an expression, click Add Watch, which will load the expression into a Watch window. Be aware that closing the Watch window will remove your expression, but the expression will be part of a history list that you can select from.

Watching Variables with Pin To Source

While debugging, you can hover over any variable to see its value, but when you move the mouse away, the tooltip with the value goes away. The Pin To Source feature goes a step further by displaying the value all the time. To use Pin To Source, right-click the variable and select Pin To Source. Alternatively, you can hover over the variable in the debugger and click the push-pin that shows with the tooltip. Figure 6-14 shows a pinned value.

Once you’ve pinned a value, you can continue debugging and scroll back up to the variable to read its current value. In addition to seeing the value, you can add a comment by clicking the chevron that appears when you hover over the pinned value. The pinned value is commented with “product of discount and sum of order items.”

Page 187
Image 187
Microsoft 9GD00001 manual Watching Variables with Pin To Source, The Quick Watch window