O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9.6. The char type

Like Java, a char in C# is a 16-bit Unicode character instead of the traditional 8-bit ASCII character of older programming languages. Table 9.5 shows escape the sequences supported by C# which can be used in character assignments or within string literals.

Table 9.5. Escape sequences for characters and strings
Escape sequenceCharacter representedComments
\'single quoteSame as in Java
\"double quote
\\backslash
\0null
\aalert (beep sound)No such escape sequence in Java – For example, System.Console.WriteLine("\a "); causes a beep.
\bbackspaceSame as in Java
\fform feed
\nnew line
\rcarriage return
\thorizontal tab
\vvertical tabNo such escape sequence in Java

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required