【发布时间】:2011-02-10 06:13:35
【问题描述】:
嗨,我可以知道如何在使用 linq 时选择“案例”条件吗? 注释掉的代码是我的问题。我如何把条件放在那里? 我的代码:
var r = from u in Users
join p in Payments on u.Id equals p.UserId
join soi in SaleOrderItems on p.ReferenceId equals soi.Id
//if soi.InventoryTypeId == 1
//then join i in Inventories on soi.InventoryOrCourseId equals i.Id
//elseif soi.InventorytypeId ==2
//then join c in Courses on soi.InventoryOrCourseId equals c.Id
where u.Id == 5
select new{ u, p, soi, either i or c};
【问题讨论】:
标签: linq