c# Lambda 表达式

delegate int del(int i);
static void Main(string[] args)
{
    del myDelegate = x => x * x;
    int j = myDelegate(5); //j = 25
}

创建表达式树类型:

using System.Linq.Expressions;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Expression<del> myET = x => x * x;
        }
    }
}

 

posted @ 2013-04-03 17:13  louiskoo  阅读(153)  评论(0编辑  收藏  举报