Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete variables in immediate window in C#

Tags:

c#

Once I've created a variable in the immediate window in C# (VS2008), is there any way to delete it so I can create a new variable with the same name but a different type? Apart from restarting the program that is.

The reason would be to keep the immediate window's namespace clean, since it's difficult to keep track of variable declarations once they scroll off the visible part of the window.

like image 915
Simon D Avatar asked Sep 23 '08 10:09

Simon D


People also ask

How do I display a variable value in immediate window?

Working With Variables To view the variable's value, simply type its name into the immediate window and press Enter. The value, "Hello world" will be displayed beneath the typed line, as in the image above. To access properties of a variable or value, use the member access operator (.) as you would within source code.

How do I Debug an immediate window?

To display the Immediate window, open a project for editing, and then choose Debug > Windows > Immediate or press Ctrl+Alt+I. You can also enter Debug. Immediate in the Command window. The Immediate window supports IntelliSense.

Can you delete variables?

so you cannot “delete” variables, you can only change their value.


3 Answers

I don't think it is possible to do what you are asking.

like image 187
Compile This Avatar answered Sep 19 '22 10:09

Compile This


You could make a dictionary to hold your immediate window "variables". Then you can remove items from the dictionary when you're done with them.

like image 30
Amy B Avatar answered Sep 21 '22 10:09

Amy B


If you just want to keep namespace clean, you can use object instead of the types you've declared for the variable? But, don't know if there exists any method to clear them!

like image 28
Ali Ersöz Avatar answered Sep 20 '22 10:09

Ali Ersöz