Delete variables in direct window in C #

Once I created a variable in a direct window in C # (VS2008), is there a way to delete it so that I can create a new variable with the same name but with a different type? Besides restarting the program that is located.

The reason is to keep the namespace in the direct space clean, as it is difficult to track variable declarations as soon as they scroll through the visible part of the window.

+6
c #
source share
4 answers

I do not think that you can do what you ask.

+5
source share

You can make a dictionary to store your immediate "variables" in a window. You can then remove items from the dictionary when done with them.

+2
source share

If you just want the namespace to be clean, can you use the object instead of the types you specified for the variable? But I don’t know if there is any method of cleaning them!

+1
source share

You can do something similar to the following:

public void LolFunction() { { int main = 0; Console.Writeline(main); } { string main = "Roflstring"; Console.Writeline(main); } } 
0
source share

All Articles