Teacher starts the discussion: Sometimes we do not want to operate through instances of a type. Instead, we prefer to work on the type itself. The concept of class variables or class methods comes to mind in these scenarios. They are commonly known as
static variables
or
static methods
. In C#, the class itself can be static. In general, when we tag the keyword static to a class, it is a static class; when it is tagged with a method, it is called a static method; and when we associate it with a variable, it is known as a static variable.
Class Variables
Let’s begin ...