Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# - is SHORT data type or it is still INT?

I am doing some classification and I am not sure:

INT is a primitive datatype with keyword "int"

But I can use Int16,Int32 or Int64 - I know C# has its own names for them. But are those data types as well or it is still INT? And mainly, can we say "short" is a datatype or INT16 is a datatype? Thanks :)

like image 404
Monty Avatar asked Aug 07 '10 16:08

Monty


1 Answers

In C#, the following things are always true:

  • short == Int16
  • ushort == UInt16
  • int == Int32
  • uint == UInt32
  • long == Int64
  • ulong == UInt64

Both versions are data types. All of the above are integers of various lengths and signed-ness.

The main difference between the two versions (as far as I know) is what colour they are highlighted as in Visual Studio.

like image 64
Mike Caron Avatar answered Oct 11 '22 07:10

Mike Caron