Predefined data types

C# defines the following data types:

  1. sbyte
  2. short
  3. int
  4. long
  5. byte
  6. ushort
  7. uint
  8. ulong
  9. float
  10. double
  11. decimal
  12. bool
  13. char
  14. string

sbyte, short, int and long are singed integer type.

byte, ushort, unit and ulong are unsigned integer types

Predefined C# types have alias in System namespace.

For example, the alias for int type is System.Int32


using System;

class Program
{
    static void Main(string[] args)
    {
        int i = 5;
        System.Int32 j = 10;

        Console.WriteLine(i);
        Console.WriteLine(j);
    }
}

The output:


5
10
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.