Difference between long and int in C#?

后端 未结 6 642
日久生厌
日久生厌 2021-02-03 17:40

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

6条回答
  •  醉话见心
    2021-02-03 18:25

    an int (aka System.Int32 within the runtime) is always a signed 32 bit integer on any platform, a long (aka System.Int64) is always a signed 64 bit integer on any platform. So you can't cast from a long with a value above Int32.MaxValue or below Int32.MinValuewithout losing data.

提交回复
热议问题