Visual Studio Tip: Examining long strings while debugging

Long strings can be a pain to examine in Visual Studio while you're debugging but in .NET projects you can easily write these to a file on the fly. If for example we want to examine the contents of string s, open up the Immediate Window (Ctrl+I) and type

 System.IO.File.WriteAllText("C:\\Debug.txt", s); 

Then open up C:\Debug.txt to see the entire string.