Given the following, when is foo bound?
System.Timer t = new System.Timer( (a)=>{
var foo = Messages.SelectedItem as FooBar;
});
Is it bound then the anonymous method is executed, or when the method is defined?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
foois not bound at all, as it’s internal to the anonymous method. It will call Messages.SelectedItem. If Messages is an instance property, what is bound is the ‘this’ instance, which is used to get at Messages.