Jul 24, 2009 at 4:39 AM
Edited Jul 24, 2009 at 4:40 AM
Ok, so I feel a bit silly posting this after all this time, but I just had a flash of insight.
If I have a method like this:
public void DoStuff(Func<Foo> fooFactory)
... then right now I can call it like this:
However, it has just occurred to me that I can also call it like this:
Container.Resolve<Foo> is just a Func that returns a Foo, so I can pass that directly without having to call LazyResolve<Foo>. It also works if the function requires parameters - you just pass container.Resolve<Foo, Bar, int, string>
Do we need LazyResolve? Do you think the former is more readable, or could we ditch LazyResolve and just pass the Resolve method pointer around like that?