Visual studio: Dump data to file from immediate window

Friday afternoon I started a test run against an API to sort some file issues out. Saving the result in a List<string> while running to dump it out to a text file when done. Due to bad formatting of the filename I got an unhandled exception. Quick test code doesn’t always include try-catch statements where they should as you know. Since the the information was in the list I went ahead and dumped it out to a new text file via the immediate window.

You can more or less run any code via the immediate window as long as everything you need are in the current context. I wrote a short example on how to do this if you ever run into the same issue. Immediate-window-demo on Github.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: