Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the value of a variable during execution time?

I want to know if there is any way I can change the value of a variable during execution time, using Visual Studio 2008? I know I can do this on Eclipse (put a breakpoint, add a watcher and edit whatever variable value I want) but I didn't find this feature on VS yet?

Any idea?

Thanks.

like image 578
Amokrane Chentir Avatar asked Jun 04 '10 08:06

Amokrane Chentir


People also ask

Is it possible to change the value of a variable while?

yes ,it is possible to change the value of a variable while debugging in a c# application .

Can the contents of a variable changed while the program is running?

A constant is a data item whose value cannot change during the program's execution. Thus, as its name implies – the value is constant. A variable is a data item whose value can change during the program's execution.

How can the value of a variable be modified while debugging?

You can change a variable in the Evaluate dialog or in the Watch List panel. The Evaluate dialog: To invoke the dialog, press the Call the Evaluate Dialog button on the Debug toolbar, or press the Ctrl+F12 shortcut (this is the default shortcut. You can change it any time.

Which variables value Cannot be changed?

A variable whose value can not be changed during the execution of the program is called a constant variable.


1 Answers

In VS if you hover your mouse over this variable, you'll notice it displays it's value in a tooltip. You can click into this tooltip and edit it manually - though you need to provide a value of the correct format for the data type. Strings also need quotes "".

There is likely a way to do this via some of the other debugging windows, but I don't know of any. I'll leave those answers to someone else.

like image 79
Adam Houldsworth Avatar answered Sep 20 '22 08:09

Adam Houldsworth