You are misunderstanding how var works. Var just means the compiler will infer the type for you. It doesn't mean that the compile-time type of a variable can change over time. No statically typed language allows the same variable to be both a string and an int. If you wanted to do what you have listed above, why not use object or two different variables?