Using ValueInjecter, I often find myself writing code like this:
var foo1 = new Foo().InjectFrom(foo2);
But that, unexpectedly, causes foo1 to be of type Object, not Foo. Same with
var foo1 = (new Foo()).InjectFrom(foo2);
and
Foo foo1 = new Foo().InjectFrom(foo2);
won't compile. It's not a big deal, because I can easily do
var foo1 = (Foo)new Foo().InjectFrom(foo2);
or
var foo1 = new Foo();
foo1.InjectFrom(foo2);
and those both work as expected, but I'm curious. Why does the first way not work?