Add to SortedList, get by key and index : SortedList : Collections Data Structure C# Source Code


Custom Search

C# Source Code » Collections Data Structure » SortedList »

 

Add to SortedList, get by key and index








    
 
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        SortedList footballTeams = new SortedList();
        footballTeams.Add(1, "S");
        footballTeams.Add(2, "K");
        footballTeams.Add(3, "I");

        for (int i = 0; i < footballTeams.Count; i++) {
            Console.WriteLine("KEY: " + footballTeams.GetKey(i) +
               "   VALUE: " + footballTeams.GetByIndex(i));
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Collections Data Structure
» SortedList