Verbatim strin is
any regular string which is starts from @ character.
For example: @”Hello
World”
Verbatim string
used when you want to print multiline text in C#. When we used verbatim literal
then any escape sequence character in string neglect by C# compiler.
Example:
1) string strText = “Hello
\t World” //OP is: Hello World
In this example C#
complier consider \t as escape sequence so which is used as horizontal tab.
2) string strText1 = @“Hello
\t World” //OP is: Hello \t
World
In this example C#
complier neglect escape sequence as we used verbatim literal(@) so what we
write after verbatim literal its print as it is.
No comments:
Post a Comment