![]() |
Stack represents a last-in, first out collection of object. It is used when you need a last-in, first-out access of items. When you add an item in the list, it is called pushing the item and when you remove it, it is called popping the item. Stack<T>.Push(T) Method is used to inserts an object at the top of the Stack<T>. Properties:
Syntax: void Push(object obj); Example:
Output:
Total number of elements in the Stack are : 1 Total number of elements in the Stack are : 2 Total number of elements in the Stack are : 3 Total number of elements in the Stack are : 4 Total number of elements in the Stack are : 5 Total number of elements in the Stack are : 6 Reference: |
Reffered: https://www.geeksforgeeks.org
C# |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 10 |