When to use short?

前端 未结 4 605
心在旅途
心在旅途 2021-01-20 03:23

Say I\'m looping through like 20/30 objects or in any other case where I\'m dealing with smaller numbers, is it a good practice to use short instead of int?

I mean w

4条回答
  •  鱼传尺愫
    2021-01-20 04:01

    In general, using numbers that matches the word size of the processor is relatively faster than unmatching numbers. On the other hand, short uses less memory space than int. If you have a limited memory space, using short may be the alternative; but personally I have never encountered such a thing when writing c# applications.

提交回复
热议问题