C# includes a number of pre-defined “built-in” data types. Each built-in data type is represented by a class in the System namespace that inherits from the base System.Object class. For example, an integer is represented by the System.Int32 class, and a string is represented by the System.String class.

C# defines an alias keyword for each built-in type. The alias keyword and its corresponding C# type are interchangeable. For example, you can define a string with the “string” keyword or “System.String” type:

string s1 = "Hello";
System.String s2 = "World";

The following table shows the built-in C# types, their alias keywords and corresponding C# type:

C# Built-In Type .NET Framework Type
bool System.Boolean
byte System.Byte
char System.Char
decimal System.Decimal
double System.Double
float System.Single
int System.Int32
long System.Int64
object System.Object
sbyte System.SByte
short System.Int16
string System.String
uint System.UInt32
ulong System.UInt64
ushort System.UInt16
Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Google Bookmarks
  • Slashdot