TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
357
121.1k
How does this Lambda expression work?
Sep 9 2012 4:06 PM
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
Reply
Answers (
15
)
remove listbox valueid on selection of another listbox item
C# 2008 projects share a database file