The Stack class implements an object that is a stack of elements.
Principle of stack operation is First in - Last out. Elements are always added to the beginning of a stack and are removed from the beginning. For working with elements, various methods of stack are used: Peek, Pop, Push. To check presence of element in stack, use the Contains method.
Property name | Brief description | |
Count | The Count property returns the number of array elements. |
Method name | Brief description | |
Clear | The Clear method clears the stack. | |
Clone | The Clone method creates a copy of the stack. | |
Contains | The Contains method checks if an element exists in the stack. | |
Peek | The Peek method extracts value of the element placed to the stack as the last one without removing the element itself. | |
Pop | The Pop method extracts value of the element placed to the stack as the last one with removing the element itself. | |
Push | The Push method places the element into the top of the stack. | |
ToArray | The ToArray method converts a stack into a standard array. |
Method name | Brief description | |
CopyTo | The CopyTo method copies the collection into an array. |
See also: