Use escape sequences in strings in CSharp

Description

The following code shows how to use escape sequences in strings.

Example


  /*from  ww w. jav a  2 s.  c  om*/
 
using System; 
 
public class StrDemo {    
  public static void Main() {    
    Console.WriteLine("Line One\nLine Two\nLine Three"); 
    Console.WriteLine("One\tTwo\tThree"); 
    Console.WriteLine("Four\tFive\tSix"); 
 
    // embed quotes 
    Console.WriteLine("\"Why?\", he asked."); 
  }    
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var