我想在單個查詢中複製以下邏輯。需要一個linq查詢,其中包含指示屬性與二級列表中的所有值匹配
var currentRows = resultsTable.AsEnumerable();
foreach (var wholeWord in excludeWholeWords)
{
currentRows = from row in currentRows
where !FoundWholeWord(wholeWord, row.Field<string>("busdescl"))
select row;
}
resultsTable = currentRows.CopyToDataTable();
我曾嘗試以下,但它導致了匹配,如果!FoundWholeWord是真實的任何全字,而不是我的意圖(這是一個比賽意味着什麼!FoundWholeWord是真的在excludeWholeWords所有項目
var matchGvRows = (from wholeWord in excludeWholeWords
from row in gvkeysTable.AsEnumerable()
where !FoundWholeWord(wholeWord, row.Field<string>("busdescl"))
select row).Distinct();
任何想法?
Aggregate按我的意圖工作,但需要比@Klaus的第二個示例長很多。 – rediVider 2011-02-18 19:47:34