Search code examples
c#64-bit32-bitprimitive

Is an int a 64-bit integer in 64-bit C#?


In my C# source code I may have declared integers as:

int i = 5;

or

Int32 i = 5;

In the currently prevalent 32-bit world they are equivalent. However, as we move into a 64-bit world, am I correct in saying that the following will become the same?

int i = 5;
Int64 i = 5;

Solution

  • No. The C# specification rigidly defines that int is an alias for System.Int32 with exactly 32 bits. Changing this would be a major breaking change.