Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C#
Tip/Trick

Verbatim String

Rate me:
Please Sign up or sign in to vote.
2.67/5 (3 votes)
5 Nov 2010CPOL 17.9K   1   8
Take the String in the Order I specify
Verbatim string allows you to specify the string in the formated order that you type. These string can be specified as @"Something here".

The Verbatim string Ignores Escape sequences \t \n \r etc.,
At the Same time they do detect it when you actual typed it in your string.

Conside the below code sample:
C#
static void Main(string[] args)
{
  string verbatim_str = @"The Game.exe requires Command line parameters
Usage Game.exe \t \n \r
Here,
t : play tiles
n :Number of tiles
r:  Restart Game" ;
  Console.WriteLine(verbatim_str);
}


Note, in the Example we like \t \n \r to be appeared as it is and at the same time expecting the string to detect newline and tab that we typed.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer iSOFT
India India
I am working as software engineer in iSOFT R&D. I have been come across C++,MFC, .net technologies. I do like playing video games, reading books.

Web: www.mstecharticles.com


Comments and Discussions

 
GeneralOh... give me a brake! I said that it's usefull, am I? For m... Pin
n.podbielski15-Nov-10 5:19
n.podbielski15-Nov-10 5:19 
GeneralThanks maharba_z! Nice comment man n.podbielski. It is very ... Pin
Sivaraman Dhamodharan10-Nov-10 22:16
Sivaraman Dhamodharan10-Nov-10 22:16 
GeneralWell, it's perfect for the beginners... but you could have e... Pin
maharba_z10-Nov-10 12:46
maharba_z10-Nov-10 12:46 
GeneralIt's usefull if you don't know about @"" string. :) Pin
n.podbielski9-Nov-10 19:53
n.podbielski9-Nov-10 19:53 
GeneralReason for my vote of 3 Useful reminder for beginners. Pin
dmjm-h9-Nov-10 7:44
dmjm-h9-Nov-10 7:44 
GeneralReason for my vote of 1 please! Pin
Hrusha429-Nov-10 4:35
Hrusha429-Nov-10 4:35 
GeneralNot that Much useful right? Sorry for that. Pin
Sivaraman Dhamodharan7-Nov-10 15:57
Sivaraman Dhamodharan7-Nov-10 15:57 
Not that Much useful right? Sorry for that.
GeneralSorry, I couldn't vote your tip/trick, but I did not found a... Pin
Toli Cuturicu7-Nov-10 1:39
Toli Cuturicu7-Nov-10 1:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.