說我創建了兩個臺的元組,像這樣:與匿名類型的LINQ在VB中工作,C#
Dim losSPResults As List(Of spGetDataResults) = m_dcDataClasses.spGetData.ToList
Dim loTupleKeys = From t In losSPResults Select t.key1, t.key2
'' Query on an existing dataset:
Dim loTupleExistingKeys = from t in m_losSPResults Select t.key3, t.key4
現在我想,像這樣在這兩個列表進行設置操作:
Dim loTupleSetDifference = loTupleKeys.Except(loTupleExistingKeys)
顯然,LINQ的不能在臺進行比較,如果它不知道集具有統一的定義,所以它會給我這個版本的錯誤:
Option Strict On disallows implicit conversions from 'System.Collections.Generic.IEnumerable(Of < anonymous type>)' to 'System.Collections.Generic.IEnumerable(Of < anonymous type>)'.
如何使用這些設置的聲明來使它們齧合? (對谷歌不多運氣)
[編輯] 仍然得到同樣的編譯錯誤:
'*** If we have initialized the list of tools, check to make sure it's up to date
Dim loTupleDatabaseTools = From tt In lottTorqueTools _
Select StationIndex = tt.station_index, SlotNumber = tt.slot_number
Dim loTupleToolObjects = From tt In m_lottTorqueTools _
Select StationIndex = tt.StationIndex, SlotNumber = tt.SlotNumber
Dim loTupleSetDifference = loTupleDatabaseTools.Except(loTupleToolObjects)
錯誤是在這裏:
昏暗loTupleSetDifference = loTupleDatabaseTools.Except(loTupleToolObjects)
Error 5 Option Strict On disallows implicit conversions from 'System.Collections.Generic.IEnumerable(Of < anonymous type>)' to 'System.Collections.Generic.IEnumerable(Of < anonymous type>)'.
啊。我編輯了上面列的名稱。那肯定是問題 - 名稱不同?我該如何解決這個問題? – Daniel 2009-05-06 14:15:00