CollectionsUtil.CreateCaseInsensitiveSortedList() : CollectionsUtil « Collections Data Structure « C# / C Sharp






CollectionsUtil.CreateCaseInsensitiveSortedList()

  

using System;
using System.Collections;
using System.Collections.Specialized;

class TestCollectionsUtils
{
    public static void Main()
    {
        Hashtable population1 = CollectionsUtil.CreateCaseInsensitiveHashtable();

        population1["a"] = 1;
        population1["b"] = 2;
        population1["c"] = 3;
        population1["d"] = 4;
        SortedList population2 = CollectionsUtil.CreateCaseInsensitiveSortedList();

        foreach (string city in population1.Keys)
        {
           population2.Add(city, population1[city]);
        }
        Console.WriteLine("{0}'s population is: {1}", "A", population2["A"]);
        Console.WriteLine("{0}'s population is: {1}", "B", population2["b"]);
        Console.WriteLine("{0}'s population is: {1}", "C", population2["c"]);
        Console.WriteLine("{0}'s population is: {1}", "D", population2["D"]);
    }
}

   
    
  








Related examples in the same category

1.CollectionsUtil.CreateCaseInsensitiveHashtable()
2.Extends Collection to create Set