ThreadPool.QueueUserWorkItem(new WaitCallback((_) => { MyMethod(param1, Param2); }), null);
Could you please explain the meaning of underscore (_) in the WaitCallBack constructor?
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.
The unserscore is actually the argument to the anonymous method. It’s a common technique if a lambda expression that takes an input parameter is needed, but the input parameter is not actually used.
It’s exactly equivalent to: