linq 中执行方法

  Database1Entities db = new Database1Entities();
        protected void Page_Load(object sender, EventArgs e)
        {
            var ddd = from a in db.Table.ToList()
                      let ad = Get(a.Name)
                      select new
                      {
                          n = ad[0],
                          nn = ad[1]

                      };
            GridView1.DataSource = ddd;
            GridView1.DataBind();

        }
        public string[] Get(string aaa)
        {
            return new string[] { "1", "2" };
        }

简单 看下就够了!!

posted @ 2015-02-01 11:27  crazyair  阅读(305)  评论(0编辑  收藏  举报