In this article we will check what are constants in C#.Net.
You can also check out
A constant is a variable whose value cannot be changed throughout its lifetime. We have to use const keyword to declare a constant like below:
const int number = 10;
some points to remember while working with constant:
– They must be initialized when they are declared; and after a value has been assigned, it can never be overwritten.
– The value of a constant must be computable at compile time. You can’t initialize a constant with a value taken from a variable. If you need to do this, you must use a read-only fi eld
– Constants are always implicitly static.
You May Also like the Following SharePoint Tutorials: