Q: Type inference against type defined in unreferenced namespace Given a class and namespace defined as follows;
namespace Models
{
    public class Foo
    { 
    }
}

And the following...
namespace Factories
{
    using Models;

    class FooFactory
    {
        public Foo GetFoo()
        {
            return new Foo();
        }
    }
}

And finally...
namespace InferenceTest
{
    using Factories;

    class Program
    {
        static void Main()
        {
            Foo foo = new FooFactory().GetFoo();
        }
    }
}

As you would expect, this code fails to compile with the error "The type or namespace name 'Foo' could not be found (are you missing a using directive or an assembly reference?)"
However, if I change the line to this...
var foo = new FooFactory().GetFoo();

Then it compiles and runs just fine.
Why is there this difference? What is it about type inference that allows it to see types in namespaces that have not been imported. Are namespaces just syntactic sugar?

A: The reason for var foo = new FooFactory().GetFoo(); compile is simple. The compiler infer that foo is Models.Foo type not only Foo.
Is symilar to push Models.Foo foo2 = new FooFactory().GetFoo();.
Notice that Foo foo2 = new FooFactory().GetFoo(); is diferent.

A: namespaces that have not been imported is your invalid reason; you don't import namespaces but use them as if they were local. The only import that happening in compiling is referencing an assembly even though it isn't real import, just some metadata is imported. (Such as versions and GUIDs)
It means that when you reference assembly such as System.dll you can use all of the classes in it; to show you the extent of the meaning of it I will give you this reflection example:
internal class Program {
    private static void Main( ) {
        System.Type.GetType("System.Console")
            .GetMethod("WriteLine",new[] {System.Type.GetType("System.String")})
            .Invoke(null,new object[]{"Hello World"});
    }
}

You didn't "imported" any namespace but still used string Console's WriteLine and some reflection features without the compiler knowing it in compile time because you had System.dll referenced to your project.
