What is Symbolic Constant in C#?

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;


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);


Freezing point of water: 42
Boiling point of water: 222

See also:

Leave a Comment