Why would this compile?

Viewed 1591

I created a "const" for a value previously explicitly stated several times in my code:

private static readonly int QUARTER_HOUR_COUNT = 96;

When I did a search-and-replace of 96 for QUARTER_HOUR_COUNT, I inadvertently also replaced the declaration, so it became:

private static readonly int QUARTER_HOUR_COUNT = QUARTER_HOUR_COUNT;

...yet it compiled. I would think that it would disallow that. Why was it accepted by the compiler as a valid declaration?

5 Answers
Related