Thursday 22 March 2012

Creating SortedList


// Create a contact list of your friends using Sorted List
using System;
using System.Collections;

class Program
{
static void Main()
{
SortedList ContactList=new SortedList();

//Adding Names and address of your friend in contact list
ContactList.Add("Ankur Bhatnagar","Hyderabad");
ContactList.Add("Smriti Dabgar","Bareilly");


foreach(object key in ContactList.Keys)
{
Console.WriteLine("{0} Lives In {1}",key,ContactList[key]);
}
}
}

No comments:

Post a Comment