In C# if i declare a constant variable is any memory allocated to it as it acts as a compile time replacement? How long is the variable's life?
consts are compile time replacements. Section 14.16 in the spec I have handy:
A constant expression is an expression that shall be fully evaluated at compile-time.
No memory is allocated since the value is put directly into code. The compiler places the constant in the assembly metadata, so the lifetime of the constant is the lifetime of the assembly it's in.