Archive for April, 2010

Amusing Bad Programming Tip

Say you have a class with a property that’s a string. Using object initializers you can do this little nugget:

Product p = new Product { ProductName = Console.ReadLine() };

It will work as you’d expect (prompt you for input, then assign it to ProductName). However, that’s pretty easy to miss when you’re quickly scanning code. [...]