How does this Lambda expression work?
Hi
Given this code example:-
public readonly Dictionary<Type, Func<Object>> providers = new Dictionary<Type, Func<Object>>();
public void Bind<T>(T instance)
{
providers[typeof(T)] = () => instance;
}
My question is why is a Lambda expression used for the assignment of the parameter "instance" to providers[typeof(T)]?
I tried assigning the "instance" parameter on its own but got a cast\conversion error.
Regards
Steven