C# Stack ToString

Description

Stack ToString returns a string that represents the current object.

Syntax

Stack.ToString has the following syntax.


public virtual string ToString()

Returns

Stack.ToString method returns A string that represents the current object.

Example


using System;//from   w ww  .  jav a 2s. co  m
using System.Collections;
public class SamplesStack  {

    public static void Main()  {
       Stack mySourceQ = new Stack();
       mySourceQ.Push( "A" );
       mySourceQ.Push( "B" );
       mySourceQ.Push( "C" );

       Console.WriteLine(mySourceQ.ToString() );

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack