Tuesday, June 20, 2006

Immediate window + System.IO.File.WriteAllText()

I'm sure I'm probably the last person to have thought of this....

With the new System.IO.File.WriteAllText() method in v2.0, it's ultra easy to walk up to an object in the immediate windows of VS 2005 and empty it into a file of your choice...as an example, you can easily type the following into the immediate window:

//assuming nameofthevariable is in scope of course...

System.IO.File.WriteAllText("c:\\temp\\somedata.txt", nameofthevariable.ToString())

BTW, in case you didn't know already, you don't need the semi colon at the end of the statement in the immediate window

1 comments:

Jesmond said...

thanks it was really helpful