C# uses the string(System.String) type to represent unchangable unicode character list.
To create a simple string we just assign string literal to a string type variable.
using System;
class Sample
{
public static void Main()
{
string str = "rntsoft.com";
Console.WriteLine(str);
}
}
The output:
rntsoft.com
The following string literal has escaped sequence.
Escape sequence is for non-inputable character, such new line character.
using System;
class Sample
{
public static void Main()
{
string str = "rntsoft.com \n rntsoft.com";
Console.WriteLine(str);
}
}
The output:
rntsoft.com
rntsoft.com
Verbatim string
using System;
class Sample
{
public static void Main()
{
string path = @"c:\a\b\c\d.exe";
Console.WriteLine(path);
}
}
The output:
c:\a\b\c\d.exe