I have a stack in which certain array of strings is pushed.when I want to pop the stack I need to remove the topmost element(the last element that was in) and pop the rest….
if (simpleStack.Count > 0)
{
simpleStack.Peek().Remove(0);
string open = simpleStack.Pop();
PopulateListView(open);
complicatedStack.Push(open);
}
I’m trying to peek the element and remove but it doesn’t seems to work.
Not sure what the issue is – pop the first item. That will remove it from the stack.
Then you can pop the remaining items.