Push Integer into a Stack : Stack « Data Structure « VB.Net






Push Integer into a Stack

Push Integer into a Stack
  
Imports System
Imports System.Collections
Imports System.Collections.Specialized


Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Dim letter_stack As New Stack
       
        
        ' Add the letters to the stack.
        For i As Integer = 0 To 10
            Console.WriteLine(i)
            letter_stack.Push(i)
        Next

        ' Remove the letters from the stack.
        Do While letter_stack.Count > 0
            Console.WriteLine( DirectCast(letter_stack.Pop(), Integer) )
        Loop
    End Sub
End Class
  

           
         
    
  








Related examples in the same category

1.Simple Demo for Stack: Push, Pop and PeekSimple Demo for Stack: Push, Pop and Peek
2.Stack to ArrayStack to Array
3.Stack Demo: push, pop and peekStack Demo: push, pop and peek
4.Stack<(Of <(T>)>) the ToArray method.
5.Stack Class represents a simple last-in-first-out (LIFO) non-generic collection of objects.