我有以下数组,我通过它循环并将结果输出到控制台。虽然我没有看到它的任何问题,但输出是空的:
Module Module1
Sub Main()
Dim Fields As New List(Of Tuple(Of Integer, String, List(Of Tuple(Of Integer, String)))) From {
Tuple.Create(1000124, "A", New List(Of Tuple(Of Integer, String)) From {
Tuple.Create(1038231, "A1"),
Tuple.Create(1038232, "A2"),
Tuple.Create(1038233, "A3"),
Tuple.Create(1038234, "A4")
}),
Tuple.Create(1000152, "B", New List(Of Tuple(Of Integer, String)) From {
Tuple.Create(1078247, "B1"),
Tuple.Create(1078248, "B2"),
Tuple.Create(1078250, "B3"),
Tuple.Create(1078251, "B4"),
Tuple.Create(1078253, "B5")
})
}
For Each parent In Fields
Console.WriteLine("[{0}] {1}", parent.Item1, parent.Item2)
For Each child In parent.Item3
Console.WriteLine(" [{0}] {1}", child.Item1, child.Item2)
Next
Next
Console.Read()
End Sub
End Module
我一直盯着这几个小时,却看不出我做错了什么。你能吗?