using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Practice
{
class Program
{
delegate int Mysetup(int q, int p);
static void Main(string[] args)
{
Expression<Mysetup> exp = (x, y) => y +
x ; // using lambda expression to create a expression tree
Mysetup mysetup = (x, y) => { return y + x; }; //using lambda expression creating a method
Mysetup mysetupAnonymous = delegate(int s,int t){ return s + t; }; // using delegates creating anonymous method
Mysetup seup = exp.Compile();
int result = seup(10, 20);
int result1 = mysetup(10, 20);
int result2 = mysetupAnonymous(10, 20);
}
}
}
No comments:
Post a Comment