Nine Reasons Not to Use "int" in .NET
It's official, 'int' considered harmful. Nine Reasons Not to Use "int" in .NET
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.
Comments are closed.
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!