作者:VB.NET开发
项目:System.Collection
' 导入命名空间
Imports System.Collections
Public Class SamplesStack
Public Shared Sub Main()
' Creates and initializes a new Stack.
Dim myStack As New Stack()
myStack.Push("Hello")
myStack.Push("World")
myStack.Push("!")
' Displays the properties and values of the Stack.
Console.WriteLine("myStack")
Console.WriteLine(ControlChars.Tab & "Count: {0}", myStack.Count)
Console.Write(ControlChars.Tab & "Values:")
PrintValues(myStack)
End Sub
Public Shared Sub PrintValues(myCollection As IEnumerable)
Dim obj As [Object]
For Each obj In myCollection
Console.Write(" {0}", obj)
Next obj
Console.WriteLine()
End Sub
End Class