© Vaskaran Sarcar 2018
Vaskaran SarcarInteractive C#https://doi.org/10.1007/978-1-4842-3339-9_7

7. Understanding Class Variables

Vaskaran Sarcar
(1)
560066 Bangalore, Karnataka, India
 
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 ...

Get Interactive C#: Fundamentals, Core Concepts and Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.