C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by Ecma and ISO.

C# was developed by Anders Hejlsberg and his team during the development of the .Net framework.

C# is designed for the Common Language Infrastructure (CLI). The CLI consists of executable code and a runtime environment that allows the use of a variety of high-level languages ​​on different computer platforms and architectures.

C# constants syntax

Constant values ​​are fixed values ​​that do not change during program execution. Constants can be of any basic data type, such as integer constants, floating point constants, character constants or string constants, as well as enumeration constants.

Constants can be treated as regular variables, but their values ​​cannot be modified after they are defined.

C# constants example

using System;
namespace DeclaringConstants{
    class Program
    {
        static void Main(string[] args)
        {
            const double pi = 3.14159; // 常量声明
            double r;
            Console.WriteLine("Enter Radius: ");
            r = Convert.ToDouble(Console.ReadLine());
            double areaCircle = pi * r * r;
            Console.WriteLine("Radius: {0}, Area: {1}", r, areaCircle);
            Console.ReadLine();
        }
    }}