I have this code:
this.form.Resize += new EventHandler(form_Resize);
But I want to assign some objects for later access in the form_Resize event, how can I do that?
and do I access the data in the EventArgs?
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.
You cannot “assign additional data” to a delegate, but you can create a parameterized version of the
form_Resizemethod and then use lambda expressions (in C# 3+) or anonymous delegates (C# 2+) to specify the additional data when attaching the handler. One way to write this is following: