June 2003
Intermediate to advanced
800 pages
34h 20m
English
You need a collection where items will be retrieved in the reverse order (so that the most recently added item is always accessed first).
Use the System.Collections.Stack type, which provides a last-in, first-out collection.
Stacks are used for programming tasks where you always need to access the most recent items first. Like the ArrayList and Queue, Stack is a dynamically sized array that stores objects. It starts with an initial capacity of 32 items (unless you supply a different capacity in the constructor) and doubles the capacity as needed. You can retrieve the number of items from the Count property, add an item at the top of a Stack with the Push method, or retrieve an item with the ...
Read now
Unlock full access