What is the actual difference between a long
and an int
in C#? I understand that in C/C++ long would be 64bit on some 64bit platforms(depending on OS o
int in C#=> System.Int32=>from -2,147,483,648 to 2,147,483,647.
long in C#=> System.Int64 =>from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
If your long data exceeds the range of int, and you use Convert.ToInt32 then it will throw OverflowException, if you use explicit cast then the result would be unexpected.