C# string and the @ symbol

I knew that you could use the @ symbol like this:

"c:\\temp\\temp.txt" ==> @"c:\temp\temp.txt" to make paths, etc more readable but I didn't know this:

 

Console.Writeline(@"bozo

   breath and

rubber noses");

will print out exactly as written.  I write a lot of console tools so this will simplify formatting the "usage" or help output.

Anyway, I thought it was cool...

 

 

Published Tuesday, March 18, 2003 12:40 PM by cloudycity
Filed under:

Comments

# re: C# string and the @ symbol

Cool! I never knew that either. Thanks for the info!

Just proving, once again, you learn something new about .NET every day. :)

Tuesday, April 15, 2003 8:56 PM by David Stone

# re: C# string and the @ symbol

I thought the '@' symbol was cool when I first found out about it too. But its getting to be somewhat of a pain now. Do you know how to parse it out of strings? All the resource strings have '@' prepended to them and because of that any escape characters that I might have in the strings are ignored.

cheers
August

Wednesday, June 04, 2003 8:39 PM by August

Leave a Comment

(required) 
(required) 
(optional)
(required)