C# Const vs Readonly


Const The const keyword declares constants - values that won't change throughout the lifetime of a program. Constants are initialized on declaration and are static by default. At compile time, the compiler replaces all usages with the constant's literal value. The constant-to-literal substitution has a downside - all external consumers of a constant have to be rebuilt if it changes. For example, … Continue reading C# Const vs Readonly