Boolean Type : Only true or false
Integral Types : sbyte,byte,short,ushort,int,uint,long,ulonf,char
Floating Types : float and Double
Decimal Types
String Types
Escape Sequences Types:
\a Bell (alert)
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t Horizontal tab
\v Vertical tab
\' Single quotation mark
\" Double quotation mark
\\ Backslash
\? Literal question mark
\ ooo ASCII character in octal notation
\x hh ASCII character in hexadecimal notation
\x hhhh Unicode character in hexadecimal notation if this escape sequence is used in a wide-character constant or a Unicode string literal.
Verbatim Literal
Is a string with an @ symbol prefix, as in @"hello"
Verbatim Literals make escape sequence translate as normal printable characters to enhance readability.
class Program
{
static void Main(string[] args)
{
//String type
string Name="Brijpal";
Console.WriteLine("Name {0}", Name);
string NameWithDoubleQuate = "\"Brijpal\"";
//using escape character for new line
Console.WriteLine(NameWithDoubleQuate);
string path = "E:\\C# Video";
Console.WriteLine(path);
//Usig Verbatim Literals
string pathwithLiteral = @"E:\C# Video";
Console.WriteLine(pathwithLiteral);
string str = "One\nTwo\nThree";
Console.WriteLine(str);
Console.ReadLine();
}
}
No comments:
Post a Comment