views:

138

answers:

3

Is there a way to get Visual Studio to display strings as verbatim strings (prefixed with '@')? I'd like to easily cut strings containing file paths from Visual Studio into Explorer or other apps.

Clarification: when VS displays a string in the auto, watch, immediate, etc. window, I'd like it to be formatted as as verbatim string so that I can simple copy it for use elsewhere.

A: 

You may need to clarify your question. My first thought was that you just need to prefix the string with '@' to make them verbatim, but you already know that.

string s = @"c:\my folder\";

What exactly are you trying to do with the string?

a_hardin
+5  A: 

You can click on the magnifier in VS 2008 debugger variable display and select "Text Visualizer" which will give you the text in an unmassaged format.

plinth
A: 

Here's a discussion on how to actually build verbatim-ized strings: Can I convert a C# string value to a string literal.

Plugging this in a debug vizualiser is a different story...

Cristi Diaconescu