delegate int AddDelegate(int a, int b);
AddDelegate ad = (a,b) => a+b;
AddDelegate ad = (a, b) => { return a + b; };
The two above versions of AddDelegate are equivalent. Syntactically, why is it necessary
to have a semicolon before and after the }
in the second AddDelegate? You can a compiler error ; expected
if either one is missing.
Maybe this will make it clearer:
AddDelegate ad = (a, b) =>
{
return a + b;
};
These semicolons effectively are for different lines.
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