Click here to Skip to main content
15,064,166 members
Articles / Programming Languages / C#
Tip/Trick
Posted 5 Nov 2010

Tagged as

Stats

15.5K views
1 bookmarked

Verbatim String

Rate me:
Please Sign up or sign in to vote.
2.67/5 (3 votes)
5 Nov 2010CPOL
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)

Share

About the Author

Sivaraman Dhamodharan
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
Membern.podbielski15-Nov-10 5:19 
Oh... give me a brake! I said that it's usefull, am I? For me it's good.
I don't want to argue. Keep up with your work man Smile | :)
GeneralThanks maharba_z! Nice comment man n.podbielski. It is very ... Pin
Sivaraman Dhamodharan10-Nov-10 22:16
MemberSivaraman Dhamodharan10-Nov-10 22:16 
GeneralWell, it's perfect for the beginners... but you could have e... Pin
maharba_z10-Nov-10 12:46
Membermaharba_z10-Nov-10 12:46 
GeneralIt's usefull if you don't know about @"" string. :) Pin
n.podbielski9-Nov-10 19:53
Membern.podbielski9-Nov-10 19:53 
GeneralReason for my vote of 3 Useful reminder for beginners. Pin
dmjm-h9-Nov-10 7:44
Memberdmjm-h9-Nov-10 7:44 
GeneralReason for my vote of 1 please! Pin
Hrusha429-Nov-10 4:35
MemberHrusha429-Nov-10 4:35 
GeneralNot that Much useful right? Sorry for that. Pin
Sivaraman Dhamodharan7-Nov-10 15:57
MemberSivaraman Dhamodharan7-Nov-10 15:57 
GeneralSorry, I couldn't vote your tip/trick, but I did not found a... Pin
Toli Cuturicu7-Nov-10 1:39
MemberToli 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.