1
我有一個VBA集合組成DayTots類對象(見下文)總結記錄
我使用的是對於每個迭代直通集合創建 新的集合組成的總結記錄的基礎上,日期
有沒有什麼辦法可以和Linq做到這一點?我猜想也許我可以代替 幾行代碼的東西更簡單,更直接的 使用LINQ查詢(也許使用組?)
我無法找到互聯網上的東西,似乎解決這種情況
預先感謝所有幫助
輸入採集
tDate TotTrav TotTrav TotParts
Yes No Accepted
2/27/2017 1 0 1
2/27/2017 1 0 0
2/27/2017 1 0 0
2/27/2017 0 1 0
2/28/2017 1 0 1
2/28/2017 0 1 0
2/28/2017 0 0 1
輸出集合
DatDate TotTrav TotTrav TotParts
Yes No Accepted
2/27/2017 3 1 1
2/28/2017 1 1 2
Dim cumRecs As DayTots
dim incoll, outcoll as Collection
outcoll = New Collection
For Each irec In incoll
....
outcoll.Add(cumRecs)
Next irec
'Class DayTots
Dim DatDate As Date
Dim TravYes As Integer
Dim TravNo As Integer
Dim PartsAccepted As Integer
Public Property Get tDayDate() As Date
tDayDate = DatDate
End Property
Public Property Let tDayDate(value As Date)
DatDate = value
Weekno = Int(((DatDate - DateSerial(Year(DatDate), 1, 0)) + 6)/7)
End Property
Public Property Get TotTravYes() As Integer
TotTravYes = TravYes
End Property
Public Property Let TotTravYes(value As Integer)
TravYes = value
End Property
Public Property Get TotTravNo() As Integer
TotTravNo = TravNo
End Property
Public Property Let TotTravNo(value As Integer)
TravNo = value
End Property
Public Property Get TotPartsAccepted() As Integer
TotPartsAccepted = PartsAccepted
End Property
Public Property Let TotPartsAccepted(value As Integer)
PartsAccepted = value
End Property
Linq在VBA/Office中不存在,所以,不行。 –