I was wondering today if there’s any reason to prefer using delegate {} instead of () => {}, in the cases where you need an empty function.
Do you know any reason to prefer one over another?
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’re not the same thing.
Since
delegate {}does not supply an argument list, it can be converted to a delegate that returnsvoidand takes any number of arguments (exceptrefandoutparameters).This is not the same as
() => {}, which is explicitly declared as taking no argument.