Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Collections.​Stack

Assembly: System.Collections.NonGeneric

Inheritance: object → Stack

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

Properties

public int
Count
Gets the number of elements contained in the <see cref="T:System.Collections.Stack" /> .
public bool
IsSynchronized
Gets a value indicating whether access to the <see cref="T:System.Collections.Stack" /> is synchronized (thread safe).
public object
SyncRoot
Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.Stack" /> .

Methods

public void
Clear​()
Removes all objects from the <see cref="T:System.Collections.Stack" /> .
public object
Clone​()
Returns A shallow copy of the <see cref="T:System.Collections.Stack" /> .
Creates a shallow copy of the <see cref="T:System.Collections.Stack" /> .
public bool
Contains​(object obj)
obj The object to locate in the <see cref="T:System.Collections.Stack" /> . The value can be <see langword="null" /> .
Returns <see langword="true" /> , if <paramref name="obj" /> is found in the <see cref="T:System.Collections.Stack" /> ; otherwise, <see langword="false" /> .
Determines whether an element is in the <see cref="T:System.Collections.Stack" /> .
public void
CopyTo​(Array array, int index)
array The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Stack" /> . The <see cref="T:System.Array" /> must have zero-based indexing.
index The zero-based index in <paramref name="array" /> at which copying begins.
Copies the <see cref="T:System.Collections.Stack" /> to an existing one-dimensional <see cref="T:System.Array" /> , starting at the specified array index.
public IEnumerator
GetEnumerator​()
Returns An <see cref="T:System.Collections.IEnumerator" /> for the <see cref="T:System.Collections.Stack" /> .
Returns an <see cref="T:System.Collections.IEnumerator" /> for the <see cref="T:System.Collections.Stack" /> .
public object
Peek​()
Returns The <see cref="T:System.Object" /> at the top of the <see cref="T:System.Collections.Stack" /> .
Returns the object at the top of the <see cref="T:System.Collections.Stack" /> without removing it.
public object
Pop​()
Returns The <see cref="T:System.Object" /> removed from the top of the <see cref="T:System.Collections.Stack" /> .
Removes and returns the object at the top of the <see cref="T:System.Collections.Stack" /> .
public void
Push​(object obj)
obj The <see cref="T:System.Object" /> to push onto the <see cref="T:System.Collections.Stack" /> . The value can be <see langword="null" /> .
Inserts an object at the top of the <see cref="T:System.Collections.Stack" /> .
public object[]
ToArray​()
Returns A new array containing copies of the elements of the <see cref="T:System.Collections.Stack" /> .
Copies the <see cref="T:System.Collections.Stack" /> to a new array.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object