I see some code like this:
textBox.TextChanged += (s, e) => this.Foo();
but I don’t know what are “s” and “e” ? what is the topic I should study in C# for this line of code?
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.
They are the parameters of the lambda-function.
The compiler infers their types from the context, but it is allowed to write a longer (more informative) form:
In this notation it is easier to see that they are method parameters.
On the other side of
=>is the method body.In response to comment:
Yes, you can always use the classic notation. And while that may not be ‘better’ or even ‘simpler’ it is easier to understand when you are learning this.