DEV Community

Cover image for C# Static Variables
Saoud
Saoud

Posted on

C# Static Variables

Terminology

Static method: A method called on a class.

Static variable: A variable scoped to the class.

Declaring Static Variables

A static variable includes the static keyword. For instance:

private static List<Item> _instances = new List<Item> {};
Enter fullscreen mode Exit fullscreen mode

Static variable names always begin with an _.

Top comments (0)