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?
They're not the same thing.
Since delegate {}
does not supply an argument list, it can be converted to a delegate that returns void
and takes any number of arguments (except ref
and out
parameters).
This is not the same as () => {}
, which is explicitly declared as taking no argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With