When You Really Want to be Sure it's an INT
by in CodeSOD on 2015-01-27Datatypes are difficult. So is typecasting. And if you don't understand one, you probably don't get the other either. And if you don't get either, you should probably give up on writing code and find a new career. You may get a slight pay cut for doing so, but at least you can quit spending half your salary on all those expensive reconstruction surgeries every time your coworkers go on a cluebat rampage against your face. And your coworkers will certainly appreciate not having to lose brain cells to your poorly-written functions, like these submitted by Kevin.
private int GetClassRoomArea(Int32 StudentCount) { return ((int)(Convert.ToInt32(StudentCount)) * 2 / 1000); }