In C#, symbolic constant assigns a name to the constant value. To declare a symbolic constant use const keyword, the following is the syntax:
C# Syntax For Symbolic Constant
const type identifier = value;
Example
using System; namespace SymbolicConstants { class SymbolicConstants { static void Main(string[] args) { const int FreezingPoint = 42; const int BoilingPoint = 222; System.Console.WriteLine("Freezing point of water: {0}", FreezingPoint); System.Console.WriteLine("Boiling point of water: {0}", BoilingPoint); Console.ReadLine(); } } }
Output
Freezing point of water: 42 Boiling point of water: 222