Using Int32 or what you need

Posted by Sir Psycho on Stack Overflow See other posts from Stack Overflow or by Sir Psycho
Published on 2010-05-22T13:42:33Z Indexed on 2010/05/22 13:50 UTC
Read the original article Hit count: 175

Filed under:
|

Should you use Int32 in places where you know the value is not going to be higher than 32,767?

I'd like to keep memory down, hoever, using casts everywhere just to perform simple arithmetic is getting annoying.

short a = 1;

short result = a + 1; // Error

short result = (short)(a + 1); // works but looks ugly when does lots of times

What would be better for overall application performance?

© Stack Overflow or respective owner

Related posts about c#

Related posts about arithmetic