Hello everybody, a have a little trouble.
I am trying to copy the contents of a stack to a new stack and when I delete the top element of the new stack, the initial stack is being affected even I used the new keyword and I don't want that. Any suggestions please? Here is my code I' ve been trying. Any help will be much appreciated. Thank you so much in advanced.
Dim NewSt As New Stack(Of Integer)
Dim InitialSt As Stack(Of Integer)
InitialSt = New Stack(Of Integer)
InitialSt.Push(50)
InitialSt.Push(40)
InitialSt.Push(30)
NewSt = New Stack(Of Integer)
NewSt.Pop()
I am trying to copy the contents of a stack to a new stack and when I delete the top element of the new stack, the initial stack is being affected even I used the new keyword and I don't want that. Any suggestions please? Here is my code I' ve been trying. Any help will be much appreciated. Thank you so much in advanced.
Dim NewSt As New Stack(Of Integer)
Dim InitialSt As Stack(Of Integer)
InitialSt = New Stack(Of Integer)
InitialSt.Push(50)
InitialSt.Push(40)
InitialSt.Push(30)
NewSt = New Stack(Of Integer)
NewSt.Pop()