Wednesday, October 6, 2010

Prefer readonly to const!

Prefer readonly to const! Ugh! I'm such a dummy!

Seriously! I never imagined I would find myself in a situation where it would bite me in the rear! -___-'

I made a 'fix' in some code where we had a connection string temporarily hard-coded. Unfortunately, I didn't noticed the const identifier on the variable declaration. I replaced the string literal with a property that looked for the connection string in a config file. However, because the type was a const the variable was compiled with the literal instead of only retrieving it at runtime from the config.

I probably wasted hundreds of dollars because of this mistake. :(

No comments:

Post a Comment