C# Variables

In C#, variables represent named memory locations where data is stored. They allow programs to store and modify data during execution. Let’s cover the basics of declaring and using variables, as well as the usage of the var keyword.

Declaration of Variables

When declaring a variable, you need to specify the data type (e.g., int, double, string, etc.) or use the var keyword for type inference.

Example with Explicit Type

int age = 30;
string name = "Artem";