Scott Hanselman

Nine Reasons Not to Use "int" in .NET

February 11, 2004 Comment on this post [2] Posted in Programming
Sponsored By

It's official, 'int' considered harmful.  Nine Reasons Not to Use "int" in .NET


About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
February 11, 2004 8:17
To be honest with you, when I saw the title "Nine Reasons Not To Use int", I thought "only nine"? I've had a love/hate relationship with int, but it really has nothing to do with the technology, but rather how/when it's implemented.

The technology itself is certainly useful, no doubt about that. My gripe is when you must design an object model around the int gotchas for trivial reasons that have nothing to do with the application/library you're writing. Specifically, I've been on projects where virtually every object had to use ints for numbers. This may not sound like a big deal, but trust me, it really compromises the design and literally gives me headaches.

Again, it's very useful when the solution fits the problem. I'm using it heavily in an application utilizing numbers. Being able to use numbers _anywhere_ is huge.

Up with int! Down with its misuse!
February 11, 2004 8:23

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.