Delegates in C#

Which of the following code snippets would successfully convert any expression into a delegate?

Options
1.Expression<Func<int>> subtract = () => 4 -3;
var sub = subtract.Compile();
var result = sub(); 
Console.WriteLine(result);
2.Expression<Func<int> subtract ()> => 4 -3;
var sub = compile(subtract);
var result = sub(); 
Console.WriteLine(result);

3.Either 1 or 2

4.None of these
Previous PostNext Post

Related Posts