Does it really matter to distinct between short, int, long?

前端 未结 11 757
名媛妹妹
名媛妹妹 2021-01-17 09:46

In my C# app, I would like to know whether it is really important to use short for smaller numbers, int for bigger etc. Does the memory consumption really matter?

11条回答
  •  佛祖请我去吃肉
    2021-01-17 10:49

    Memory consumption based on the type of integers you are storing is probably not an issue in a desktop or web app. In a game or a mobile device app, it may be more of an issue.

    However, the real reason to differentiate between the types is the kind of numbers you need to store. If you have really big numbers, or high precision, you may need to use long to store it.

提交回复
热议问题