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.

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

Level: Apprentice · More C# terms at this level

Updated

In other subjects