The structure below shows the various basic types of C# and the types they map to in the .Net framework.

C# Short Name .Net Class Declaration Description
bool Boolean bool isValid = true;

8 bit true or false

sbyte SByte sbyte b = -1 signed 8 bit integer
byte Byte byte b = 1; 8 bit unsigned integer
char Char char = 'a' 16 bit single Unicode character
short Int16 short s = 123; 16bit signed integer
ushort UInt16 ushort s = 15; 16bit unsigned integer
int Int32 int i = -1000000; 32bit signed integer
uint UInt32 uint i = 50000; 32bit unsigned integer
long Int64 long = 2000; 64 bit signed integer
ulong UInt64 ulong = 2000; 64 bit unsigned integer
float Single float f = 1.04f; 4 byte single precision floating point
double Double double d = 1.0E-13 8 byte double precision floating point
decimal Decimal   16 byte precise fractional or integral type that can represent decimal numbers with 29 significant digits
string String string s = "abcd"; A sequence of unicode characters

Binary Values

You can't specify a binary value in C# – specify in hexadecimal instead.

We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.