C#, VB.NET, and echoing strings in the VS.NET Immediate Window

I’ve become rather agnostic on the whole topic of C# versus VB.NET, but there are still those annoying little differences that sneak up behind you and rabbit-punch you in the kidneys. Like, say, using the VS.NET 2003 command window in immediate mode to print a string:

Printing text in the Immediate window in a VB.NET project

Usually VB.NET is guilty of handling things in odd and unexpected ways, but this time it’s C#. I expect newlines to appear in the immediate window as, oh, I don’t know... NEW LINES? It’s a bit difficult to read text filled with a bunch of rn notation instead of human readable whitespace. What’s worse is that even the variable tooltips in C# behave this way!

How can I work around this annoying “feature” of the C# IDE? I thought about creating a macro to use ?System.Diagnostics.Debug.WriteLine(s), which behaves appropriately, but the Diagnostics class isn’t always in scope at a breakpoint.

Jeff Atwood

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Overflow, Discourse, and RGMII. Disclaimer: I have no idea what I'm talking about. Let's be kind to each other. Find me https://infosec.exchange/@codinghorror

⏲️ Busy signing you up.

❗ Something's gone wrong. Please try again.

✅ Success! Check your inbox (and your spam folder, just in case).

Related posts

Monkeypatching For Humans

Monkeypatching For Humans

Although I love strings, sometimes the String class can break your heart. For example, in C#, there is no String.Left() function. Fair enough; we can roll up our sleeves and write our own function lickety-split: public static string Left(string s, int len) { if (len == 0 || s.Length

By Jeff Atwood ·
Comments
Department of Declaration Redundancy Department

Department of Declaration Redundancy Department

I sometimes (often, actually) regress a few years mentally and forget to take advantage of new features afforded by the tools I’m using. In this case, we’re using the latest and greatest version of C#, which offers implicitly typed local variables. While working on Stack Overflow, I was

By Jeff Atwood ·
Comments
Productivity Tip: Upgrade Your Pentium 4

Productivity Tip: Upgrade Your Pentium 4

In C# and the Compilation Tax, several commenters noted that they have “fast dual-core computers,” and yet background compilation performance was unsatisfactory for them on large projects. It’s entirely possible that this is Visual Studio’s fault. However, I’d like to point out that not all dual

By Jeff Atwood ·
Comments

C# and the Compilation Tax

Over the last four years, I’ve basically given up on the idea that .NET is a multiple language runtime. * The so-called choice between the two most popular languages, C# and VB.NET, is no more meaningful than the choice between Coke and Pepsi. Yes, IronPython and IronRuby are

By Jeff Atwood ·
Comments

Recent Posts

An interactive TWiT Series You're the hero of the story! Choose from 1,024 possible endings. OFF by ONE with Jeff Atwood Hosted by Leo Laporte "every choice changes everything!"

Every Choice Changes Everything: The Show

About 3 weeks ago, Leo Laporte and I recorded the first episode of what will be a new monthly show on the TWiT network. Naming things is hard, and we almost voted on the name, like we did for Stack Overflow, but we quickly landed on Off By One with

By Jeff Atwood ·
Comments
Thank You For Being a Friend

Thank You For Being a Friend

It's been one of those months, and by that, I mean one of the 663 months since I was born. This won't be a long post, because I only have two things to say. First, I'm really glad we re-ordered the GMI (Guaranteed

By Jeff Atwood ·
Comments
map of the United States via rgmii.org showing all 3,143 counties by rural (gold) / metro (grey) and population

Launching The Rural Guaranteed Minimum Income Initiative

It's been a year since I invited Americans to join us in a pledge to Share the American Dream: 1. Support organizations you feel are effectively helping those most in need across America right now. 2. Within the next five years, also contribute public dedications of time or

By Jeff Atwood ·
Comments
I’m feeling unlucky... 🎲   See All Posts