# var

A keyword asking the compiler to infer a local variable's type from its value.

## What is **var** in C#?

**var** — A keyword asking the compiler to infer a local variable's type from its value.

```csharp
class City
{
    void NormalizeName()
    {
        var name = "Denver";
        var uppercaseName = name.ToUpper();
    }
}
```

Level: Apprentice · [More C# terms at this level](https://www.ask-codey.com/glossary/subjects/c-sharp/apprentice)

Updated: September 28, 2026

## In other subjects

- [var in Java](https://www.ask-codey.com/glossary/var)
- [var in JavaScript](https://www.ask-codey.com/glossary/var-javascript)

Source: https://www.ask-codey.com/glossary/var-c-sharp
