Dim i = 2
Do While True
i += 1
If IsDBNull(TmDataSet.T.Rows(0)(i)) = True Then Exit Do
Dim new_t As New train
new_t.id = TmDataSet.T.Rows(0)(i)
Dim j = 0
Do Until IsDBNull(TmDataSet.T.Rows(j + 1)(i))
j += 1
Do Until (TmDataSet.T.Rows(j)(i) <> -1)
j += 1
Loop
If IsDBNull(TmDataSet.T.Rows(j + 1)(i)) Then Exit Do
Dim new_st As New station
new_st.t = TmDataSet.T.Rows(j)(i)
new_st.name = TmDataSet.T.Rows(j)(1)
new_st.id = TmDataSet.T.Rows(j)(2)
new_st.id_t = new_st.id.ToString & new_st.t
Dim new_st2 As New station
Do Until (TmDataSet.T.Rows(j + 1)(i) <> -1)
j += 1
Loop
new_st2.t = TmDataSet.T.Rows(j + 1)(i)
new_st2.name = TmDataSet.T.Rows(j + 1)(1)
new_st2.id = TmDataSet.T.Rows(j + 1)(2)
new_st2.id_t = new_st2.id.ToString & new_st2.t
Dim list As New List(Of station)
list.Add(new_st)
list.Add(new_st2)
new_t.st.Add(list)
Loop
per_network.Add(new_t)
Loop
' network = deep copy of per_network
vb >>> I just want to copy the content of per_network to network, I have tried ToList method but it was shallow copy and fail to perform clone method I didn't get it at all
See Question&Answers more detail:os