Part 03 - C# Tutorial - String type
Suggested Videos
Part 00 - Introduction to C#
Part 01 - Reading and writing to console
Part 02 - Built-in types
Verbatim Literal is a string with an @ symbol prefix, as in @“Hello”. Verbatim literals make escape sequences translate as normal printable characters to enhance readability.
Part 00 - Introduction to C#
Part 01 - Reading and writing to console
Part 02 - Built-in types
Verbatim Literal is a string with an @ symbol prefix, as in @“Hello”. Verbatim literals make escape sequences translate as normal printable characters to enhance readability.
Practical Example:
Without Verbatim Literal : "C:\\Pragim\\DotNet\\Training\\Csharp"; // Less Readable
C# example program used in the demo
using System;
namespace ConsoleApplication1
{
class Program
{
public static void Main()
{
// Displaying double quotes in c#
string Name = "\"Pragim\"";
Console.WriteLine(Name);
// Displaying new line character in c#
Name = "One\nTwo\nThree";
Console.WriteLine(Name);
// Displaying new line character in c#
Name = "c:\\Pragim\\DotNet\\Training\\Csharp";
Console.WriteLine(Name);
// C# verbatim literal
Name = @"c:\Pragim\DotNet\Training\Csharp";
Console.WriteLine(Name);
}
}
}
Tags:
C sharp