LANGUAGE

const local constant

Declares a constant using a compile-time constant expression. It cannot be reassigned. Not appropriate for values read at runtime.

Formal Syntax & Structure

csharp syntaxcsharp
const <type> <identifier> = <constant-expression>;

Working Example

Example Snippetcsharp
const int slotsPerBox = 6;System.Console.WriteLine(slotsPerBox * 2);
C# & .NET Reference