Perhaps the most important Visual Studio trick to know about the Immediate Window: To print something with all the newlines and carriage returns "invoked", so to speak, you suffix the string in question with ,nq.

Say you're debugging some SQL. This isn't horribly useful...

String with linebreaks rendered in immediate window

It's all on one line with \r\ns all over the place.

Let's try it again with ,nq afterwards...

SQL formatted without carriage returns and newlines

For some reason, I've got the SQL indented like mad (okay, okay, it's so it lines up in Visual Studio. This is a quick and dirty utility service that has embedded SQL), but you get the point. It's actually legible with the ,nq suffix.

I could've sworn I'd posted this before, but couldn't google it up in my own blog in a minute or less, so here we go again, proper keywords attached.

Labels: ,