條款我有這樣的:如何使用包含在在LINQ
var myResult = uow.GetRepository<SLItemsCustomersCard, long>()
.Query(x => x.CustomerId == customerId && x.SquareColor == squareColor)
.OrderBy(x => x.BranchMapRang)
.Select((r, i) => new { Row = r, Index = i })
.Where(x => x.Index == visitCounter - 1).ToList();
,但我想在where子句來實現這一目標:
.Where(x => x.Index.Cotains(visitCounter)).ToList();
如何做到這一點?
爲什麼查詢你沒有工作? – Magnus
'visitCounter'需要是一個'sequence',那麼你可以這樣做'(x => visitCounter.Cotains(x.Index))''。 –
'x.Index'的類型是什麼? –