Type details. We show the Int16, Int32, and Int64 types are equivalent to more commonly used types. These represent numbers with 2, 4 or 8 bytes.
Int16 -> short
Int32 -> int
Int64 -> long
An example. We declare Int16, Int32 and Int64 variables. We print the Type object corresponding to them. Then we do the same thing for the short, int and long types.
Next The program's output shows that Int16 is equal to short, Int32 is equal to int, and Int64 is equal to long in the runtime.
Int16 a = 1;
Int32 b = 1;
Int64 c = 1;
short a = 1;
int b = 1;
long c = 1;
Discussion. Should you prefer Int16 to short, Int32 to int, or Int64 to long? In programs where the number of bytes is important, you might prefer Int16, Int32 or Int64.
Tip In methods where you use int variables, it is a poor choice to use Int32 variables instead, as int is standard.
Detail For the most readable programs, the int type is usually preferred over the Int32 types.
A summary. Int16, Int32 and Int64 are important. The short, int and long types are aliased to them. Programs that specify short, int and long are using Int16, Int32 and Int64.
Dot Net Perls is a collection of tested code examples. Pages are continually updated to stay current, with code correctness a top priority.
Sam Allen is passionate about computer languages. In the past, his work has been recommended by Apple and Microsoft and he has studied computers at a selective university in the United States.
This page was last updated on Oct 11, 2023 (edit).