const

noun

say it: “KONST” /kɒnst/

A C# keyword for a value that is fixed when you write the code and can never change.

What does const do in C#?

const — A modifier for a compile-time constant whose value is fixed in its declaration.

class Cart
{
    const int MaxItems = 100;
}

In a sentence

  • “I declared the tax rate as a const, so nobody can change it by mistake.”

Level: Apprentice · More C# terms at this level

Updated

In other subjects