0
我只是在尋找如何使用LINQ來分組列表。linq concat column by val
Class Item
Public col1 As String
Public col2 As String
Public col3 As String
Public description As String
Public Sub New(ByVal col1 As String, ByVal col2 As String,
ByVal col3 As String, ByVal description As String)
Me.col1 = col1
Me.col2 = col2
Me.col3 = col3
Me.description = description
End Sub
End Class
Dim ItemList As New List(Of Item)
ItemList.Add(New Item("A", "A", "A", "1"))
ItemList.Add(New Item("A", "A", "A", "2"))
ItemList.Add(New Item("A", "B", "A", "3"))
ItemList.Add(New Item("A", "B", "A", "4"))
ItemList.Add(New Item("A", "B", "B", "5"))
ItemList.Add(New Item("A", "B", "C", "6"))
結果應該是4個項目清單:
'[0] = "A", "A", "A", "1 2"
'[1] = "A", "B", "A", "3 4"
'[2] = "A", "B", "B", "5"
'[3] = "A", "B", "C", "6"
工作,(只需要在string.join中添加一個toArray)。 – forX
現在它如何轉換爲vb.net – forX