const keyword in c#

const keyword in c#

 

Constants are declared with the const modifier. Constants are immutable values

which are known at compile time and do not change for the life of the program.  

Only the C# built-in types (excluding System. Object) may be declared as const.

 

class Details
{
    public const int age= 50;
}

 

const string Name = "Your name, string here.";

 

2021-10-03