Partager via


Stack Class

Represents a simple last-in, first-out (LIFO) non-generic collection of objects.

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)

Syntax

[DebuggerDisplayAttribute("Count = {Count}")]
[SerializableAttribute]
public class Stack : ICollection, IEnumerable, ICloneable

Remarks

The capacity of a stack is the number of elements the stack can hold.

If Count is less than the capacity of the stack, Push is an O(1) operation. If the capacity has to be increased to accommodate the new element, Push becomes an O(n) operation, where n is Count. Pop is an O(1) operation.

Version Information

Available in the .NET Micro Framework version 4.1.

See Also

Reference

Stack Members
System.Collections Namespace