#32 – Built-In Types

The C# language includes a variety of built-in types that you can use in your C# program.  Each has a built-in C# keyword for the type, but maps to a type in the .NET Framework.  The C# keyword is just shorthand for the complete type name as it exists in the framework.

Here are all of the C# built-in types that are value types, along with their class name in the .NET Framework.

  • bool – System.Boolean – 1 byte  (true|false)
  • byte – System.Byte – 1 byte   (0 to 255)
  • sbyte – System.SByte – 1 byte  (-128 to 127)
  • short – System.Int16 – 2 bytes  (-32,768 to 32,767)
  • ushort – System.UInt16 – 2 bytes  (0 to 65,535)
  • int – System.Int32 – 4 bytes  (-2,147,483,648 to 2,147,483,647)
  • uint – System.UInt32 – 4 bytes  (0 to 4,294,967,295)
  • long – System.Int64 – 8 bytes  (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
  • ulong – System.UInt64 – 8 bytes  (0 to 18,446,744,073,709,551,615)
  • float – System.Single – 4 bytes  (±1.5e−45 to ±3.4e38, 7 digit precision)
  • double – System.Double – 8 bytes  (±5.0e−324 to ±1.7e308, 15-16 digit precision)
  • decimal – System.Decimal – 16 bytes  (±1.0 × 10−28 to ±7.9 × 1028, 28-29 digit precision)
  • char – System.Char – 2 bytes  (U+0000 to U+ffff, UTF16 Unicode character)
Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: