我有以下 linq
var unionOperations =
(from r in gropOperations
select new
{
r.OPERATIONID,
r.OPERATIONNAME,
r.ISACTIVE
})
.Union(from m in customOperations
select new
{
m.OPERATIONID,
m.OPERATIONNAME,
m.ISACTIVE
}
);
它返回对象列表如下,
{ OPERATIONID = 1050, OPERATIONNAME = "NEW", ISACTIVE = TRUE }
{ OPERATIONID = 1050, OPERATIONNAME = "NEW", ISACTIVE = FALSE }
{ OPERATIONID = 1051, OPERATIONNAME = "EDIT", ISACTIVE = TRUE }
{ OPERATIONID = 1052, OPERATIONNAME = "DELETE", ISACTIVE = TRUE }
{ OPERATIONID = 1053, OPERATIONNAME = "PRINT", ISACTIVE = TRUE }
现在我想要一个如下列表:
{ OPERATIONID = 1050, OPERATIONNAME = "NEW", TRUE }
{ OPERATIONID = 1051, OPERATIONNAME = "EDIT", TRUE }
{ OPERATIONID = 1052, OPERATIONNAME = "DELETE", TRUE }
{ OPERATIONID = 1053, OPERATIONNAME = "PRINT", TRUE }
真正发生的事情是将前两条记录(OPERATIONID = 1050)与其ISACTIVE
值的“或”操作合并;