Monthly Archives: March 2009

What’s the difference between CONST and READONLY in .Net?

Ever sit around talking to your co-workers about random things, when all of a sudden you ask “What’s the difference between const and readonly in .Net?“. If so, you are not alone. If not, well, you’re just weird.

A few weeks ago, I was talking to a developer that I work with, when I asked the exact same question. I remembered though, that when I was working on Poynt while at my last job, we kept getting warnings saying that we should either change our const to readonly, or vice versa. I can’t remember exactly which one, or the reason that was given. I do also vaguley remember that it had something to do with compile time.

Knowing that I wouldn’t be able to sleep without knowing the answer to this riddle, I decided to use Google to see what I could find (If you’ve never used Google, I suggest giving it a try It’s a neat little web site that gives you links to web pages, that are relevant to what you are searching for. I have a feeling that it will become big one day). Continue reading