Show integer indexes of entries : SortedList : Data Structure C# Examples


C# Examples » Data Structure » SortedList »

 

Show integer indexes of entries









    
using  System;  
using  System.Collections;  
  
class  MainClass  {  
    public  static  void  Main()  {  
        SortedList  sl  =  new  SortedList();  
          
        sl.Add("a",  "1");  
        sl.Add("b",  "2");  
        sl.Add("c",  "3");  
        sl.Add("d",  "4");  
  
        Console.WriteLine();  
  
        //  Show  integer  indexes  of  entries.  
        Console.WriteLine("Integer  indexes  of  entries.");  
        foreach(string  str  in  sl.Keys)  
            Console.WriteLine(str  +  ":  "  +  sl.IndexOfKey(str));  
    }  
}
    
   
  
   



Output

Integer indexes of entries.
a: 0
b: 1
c: 2
d: 3


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» SortedList