When we went over the section on value type versus reference type, we understood that all of the objects created in C# have a definite scope in the program execution. However, there could be some circumstances when we would like to have a variable acquire a constant value that is consistent across all instances of the objects. We can do this using the Static keyword. A Static keyword in a modifier in C# ensures that just one instance of the variable is created and its scope is throughout the entire run of the program. We can use a Static variable against a class, its member variable, and its member methods and constructors.
Let's now look at code examples involving the Static keyword.