日期:2014-05-17  浏览次数:20544 次

两条linq的合并
C# code
 var gcols = (from d in MODEL.PROD.WorkloadStatistics.Dicworkload
                             where d.Value == "通用"
                             select new
                             {
                                 title = d.Key,
                                 field = d.Key,
                                 width = 100
                             }).ToList();
                gcols.AddRange((from d in MODEL.PROD.WorkloadStatistics.Dicworkload
                                where d.Value == works.Type || (works.isbydate && !works.isbyprocess)
                                select new
                                           {
                                               title = d.Key,
                                               field = d.Key,
                                               width = 100
                                           }).ToList());


------解决方案--------------------
没理解。。。。。
------解决方案--------------------
两个查询不是差不多吗?只是条件不同,条件也可以写在一起的啊不是吗?
不太明白楼主想干嘛
------解决方案--------------------
探讨
修改后,只要合并这个就可以了,刚发的有误

C# code

var gcols = (from d in MODEL.PROD.WorkloadStatistics.Dicworkload
where d.Value == "通用" || (works.isbydate && !works.isbyproces……