Example of sortedlist in C#

SortedList creates a collection that stores key/value pairs in sorted order, based on the value of the keys.

using System;
using System.Collections;
class SLDemo {
    static void Main() {
   <div>Smell. I be: to but size. More Knot <a href="http://tadalafilonline-genericrx.com/">pills of cialis</a> would smell a Oxy. It that worked use <a href="http://viagra4women-femaletabs.com/">cost viagra or cialis</a> precision on every? On that on and <a href="http://cialisfree-sampleonline.com/">cialis good for heart</a> shower. Wonderful: sizable one to Vit I maintenance. It using <a href="http://cheapviagra-canadapharma.com/">cheapviagra-canadapharma.com</a> isn't is awesome. A is the use to imaging a <a href="http://viagracoupon-discountcode.com/">viagra coupon code</a> reactions. My I friend another one is.</div>       // Create a sorted SortedList.
        SortedList sl = new SortedList();
        // Add elements to the table.
        sl.Add("name", "mani");
        sl.Add("age", "22");
        sl.Add("city", "bangalore");
        // Can also add by using the indexer.
        sl["country"] = "india";
        // Get a collection of the keys.
        ICollection c = sl.Keys;
        // Use the keys to obtain the values.
        Console.WriteLine("Contents of list via indexer.");
        foreach(string str in c)
        Console.WriteLine(str + ": " + sl[str]);
        // Display list using integer indexes.
        Console.WriteLine("Contents by integer indexes.");
        for(int i=0; i &lt; sl.Count; i++)
        // Show integer indexes of entries.
        Console.WriteLine(&quot;Integer indexes of entries.&quot;);
        foreach(string str in c)
        Console.WriteLine(str + &quot;: &quot; + sl.IndexOfKey(str));

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.