I have this code and it's work correctly,
private void button1_Click(object sender, EventArgs e)
{
var func = new Action<int, int>((a, b) =>
{
var sum = a + b;
MessageBox.Show(sum.ToString());
//How can I return sum?
});
//var result=func(2,3);
func(2, 3);
}
How I can change func to return sum variable, I want use function as:
var result=func(2,3);
Func<int, int, int>which you can return a+b from