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 of course) but in C# it’s all running in the .NET runtime, so is there an actual distinction?
Another question: can an int hold a long(by cast) without losing data on all platforms?
An
int(akaSystem.Int32within the runtime) is always a signed 32 bit integer on any platform, along(akaSystem.Int64) is always a signed 64 bit integer on any platform. So you can’t cast from alongwith a value aboveInt32.MaxValueor belowInt32.MinValuewithout losing data.