是否真的重要做空,INT之间不同,长时间? [英] Does it really matter to distinct between short, int, long?

查看:83
本文介绍了是否真的重要做空,INT之间不同,长时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的C#应用​​程序,我想知道它是否真的很重要使用短较小的数字,诠释了大等是否内存消耗真的重要吗?

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?

推荐答案

除非你一起在某种结构的包装大量的这些,它可能不会影响内存消耗在所有。使用特定的整数类型最好的理由是与API的相容性。除此之外,只要确保你选择的类型有足够的范围覆盖你需要的值。除此之外,简单的局部变量,它并没有多大关系。

Unless you are packing large numbers of these together in some kind of structure, it will probably not affect the memory consumption at all. The best reason to use a particular integer type is compatibility with an API. Other than that, just make sure the type you pick has enough range to cover the values you need. Beyond that for simple local variables, it doesn't matter much.

这篇关于是否真的重要做空,INT之间不同,长时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆