Stack.Pop Method

   
Stack.Pop Method

Class

System.Collections.Stack

Syntax

   stackvariable   .Pop(  ) 

Return Value

Object

Description

Removes the top item from the stack and returns it as an Object

Rules at a Glance

  • Pop removes the top item from the stack and decrements the Count property by one.

  • Pop generates an error if applied to an empty stack. Thus, it's advisable to determine when a stack is empty by using the Count property before popping the stack.

Programming Tips and Gotchas

The Peek method returns a reference to the object at the top of the stack, but unlike the Pop method, does not remove it from the stack.

See Also

Stack.Clear Method, Stack.Peek Method

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net