Page Rank

Subscribe

Categories

Recent posts

Alexa Rank

Using STACK in C#


  • This topic explains about, how to use STACK in C# programming.

StackUsing STACK in C#

  • Stack is a kind of abstract data type or collection in which the operation of the collection are the addition of the item to the collection known as PUSH and removal of the item is known as POP.
  • PUSH and POP in STACK follows Last-In-First-Out (LIFO) data structures.

Stack ClassUsing STACK in C#

  • Stack Class represents a simple last-in-first-out (LIFO) non-generic collection of objects.

Namespace:  System.Collections

Assembly:  mscorlib (in mscorlib.dll)

  • Syntax for STACK Class

Stack.Push MethodUsing STACK in C#

  • Helps to insert an object to the top of the stack.
  • Syntax

Stack.Pop MethodUsing STACK in C#

  • Helps to remove an object at the top of the stack.
  • Syntax

Stack.Contains Method Using STACK in C#


  • Determine whether an element is in the stack.
  • Syntax

Stack.CountUsing STACK in C#

  • Helps to get the number of elements contained in the Stack

Main methods used in STACK

PUSH – Push or add an item into the stack data structure.

Syntax: Stack.Push(Object)

Object: The item to be inserted.

Pop: Pop removes an item that inserted last in Stack.

Syntax: Stack.Pop()

Return: The last object in the Stack

Contains: Check the object contains in the stack

Syntax: Stack.Contains(Object)

Object: The specified Object to be seach

Using STACK in C#Complete Code

 Using STACK in C#


VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">