Output string with escape character - CSharp Language Basics

CSharp examples for Language Basics:string

Introduction

CharactersMeaning
\bBackspace
\nNewline
\tHorizontal tab
\\Backslash
\'Single quote
\"Double quote

Demo Code




using System;//from w  w w.  j a  v  a2s.  c  o  m

class chars_table
{
   public static void Main()
   {
      char ch1 = 'Z';
      char ch2 = 'x';

      Console.WriteLine("This is the first line of text");
      Console.WriteLine("\n\n\nSkipped three lines");
      Console.WriteLine("one\ttwo\tthree <-tabbed");
      Console.WriteLine(" A quote: \' \ndouble quote: \"");
      Console.WriteLine("\n ch1 = {0}   ch2 = {1}", ch1, ch2);
   }
}

Result


Related Tutorials