I know from [this question](https://stackoverflow.com/questions/356846/c-var-vs-specific-type-performance) that `var i = 1` and `int i = 1` are exactly the same in IL. The compiler simply replaces `var` with the actual type at compile time. But, are there any instances where `var` could cause problem behavior (maybe the compiler guesses the wrong type?)
['https://Stackoverflow.com/questions/5738073', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/221061/']
No, I don't think so. The only time it can't figure things out is if you try to do something like

```
var product = null;

```

Which makes sense, and in this case you get a compile error.
In addition to the ambiguous:

```
var x = null;

```

the compiler will also not infer the type of overloaded method groups:

```
var m = String.Equals;

```

nor will it infer the type of lambda expressions, which can be either `Func<>` or `Expression<Func<>>`:

```
var l = (int x) => x + 1;

```

All that said, Anthony is right: the compiler will never do the wrong thing, though it might not do what you expect. When in doubt, hover over `var` in VS to see the static type.