Using Visual Studio 2010 Professional, I have a ToString()
method that looks like this:
public override string ToString() { return "something" + "\n" + "something"; }
Because there are several "something
"'s and each is long, I'd like to see
something something
Sadly, I'm seeing
"something\nsomething"
Is there a way to get what I want?
Use the Immediate window to debug and evaluate expressions, execute statements, and print variable values. The Immediate window evaluates expressions by building and using the currently selected project.
The Immediate window displays information resulting from debugging statements in your code or from commands typed directly into the window. To display the Immediate window. From the View menu, choose Immediate window (CTRL+G).
The differences between the Command and Immediate windowsThe Command window can load dlls or packages into the IDE as well. The Immediate window, on the other hand, is solely used during debugging and is useful to execute statements, print values of a contextual variable, or even evaluate expressions.
Use the Immediate Window to Execute Commands The Immediate Window can also be used to execute commands. Just type a > followed by the command. For example >shell cmd will start a command shell (this can be useful to check what environment variables were passed to Visual Studio, for example). >
Actually there is a way. You can use format specifiers in the immediate window to change the format of the display. If you have a string with carriage returns and linefeeds in it ("\r\n") you can follow the print request with the 'no quotes' format specifier.
In the immediate window type:
?MyObj.ToString(),nq
and the \r\n
will cause newlines in the immediate window.
For more info on format specifiers see: http://msdn.microsoft.com/en-us/library/e514eeby.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With