我有以下的Linq查詢:LINQ查詢幫助
from workItem in WorkItem
join workItemHistory in WorkItemHistory on workItem equals workItemHistory.WorkItem
join ivSweepHistory in IVSweepHistory on workItemHistory equals ivSweepHistory.WorkItemHistory
where workItem.SerialNumber == "080106081985"
orderby ivSweepHistory.ReadTime descending
select ivSweepHistory
原樣,這個偉大的工程。但是,我想修改此以便我只檢索第一行而不是所有行。我將如何做到這一點?
謝謝。
對於那些對'.First'(和'.FirstOrDefault')和'.Take(x)'之間區別感興趣的人,請參閱http://stackoverflow.com/questions/1024559/when-to-use-first -and-when-use-firstordefault-with-linq/1024577#1024577 – 2010-06-15 19:47:35