C# Stack - c# - c# tutorial - c# net
What is Stack in C# ?
- C# Stack<T> class is used to push and pop elements.
- It uses the concept of Stack that arranges elements in LIFO (Last in First Out) order.
- It can have duplicate elements.
- It is found in System.Collections.Generic namespace.
C# Stack<T> example:
- Let's see an example of generic Stack
class that stores elements using Push() method, removes elements using Pop() method and iterates elements using for-each loop
Stack