C# SortedList ToString

Description

SortedList ToString returns a string that represents the current object.

Syntax

SortedList.ToString has the following syntax.


public virtual string ToString()

Returns

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

Example


using System;//from w w  w.  j a va  2 s  . c o  m
using System.Collections;
public class SamplesSortedList  {

   public static void Main()  {
      SortedList mySL = new SortedList();
      mySL.Add( 2, "two" );
      mySL.Add( 3, "three" );
      mySL.Add( 1, "one" );
      mySL.Add( 0, "zero" );
      mySL.Add( 4, "four" );

      Console.WriteLine(mySL.ToString());

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack