using System.Linq.Expressions;
using System.Collections;
using System.Collections.Generic;
public static void Main()
Console.WriteLine("****************** C# Equivalent Output **************************\n\n");
Console.WriteLine("First Statment");
Console.WriteLine("Second Statment");
Console.WriteLine("Third Statment and Second Statment is skiped");
Console.WriteLine("\n\n***************** Expression Tree Output **************************\n\n");
LabelTarget JumpTo = Expression.Label();
BlockExpression blockExpr = Expression.Block(
WriteLineExpression("First Statment"),
WriteLineExpression("Second Statment"),
Expression.Label(JumpTo),
WriteLineExpression("Third Statment and Second Statment is skiped")
Expression.Lambda<Action>(blockExpr).Compile()();
public static Expression WriteLineExpression(string s)
return Expression.Call(null,
typeof(Console).GetMethod("WriteLine", new Type[] { typeof(String) }),