test_sortedlist2
Using Foreach Loop
Code:

// Namespace Declaration
//File location : C:\BareBone_CSharp\Source_Code\Template
using System;
//csc test_sortedlist2.cs
using System.Collections;
using System.Collections.Generic;
// Program start class
namespace test_sortedlist1
{

class CsharpTemplate
{
// Main begins program execution.
static void Main(string[] str)
{
SortedList sortedlist = new SortedList();
sortedlist.Add("1", "=Jan");
sortedlist.Add("2","=Feb");
sortedlist.Add("3","=Mar");
ICollection c = sortedlist.Keys;
foreach(string str1 in c)
{
Console.WriteLine(str1 + ":"+ sortedlist[str1]);
}
//for(int i= 0; i< sortedlist.Count; i++)
//{
// Console.WriteLine(sortedlist.GetByIndex(i));
//}
}
}
}
//