LINQ 客户端生成自增列
var testQuery = (from item in TestInfo.GroupBy(t=>t.TestName) select new { TestCode = item.Min(g=>g.Code), TestName = item.Key }).OrderBy(t=>t.TestName).AsEnumerable(); var testList = testQuery.Select((item,index)=>new { ID = index+1, TestCode = item.TestCode, TestName = item.TestName }).ToList();
桂棹兮兰桨,击空明兮溯流光。