You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
610 B
C#

/*
* C# Program to Demonstrate iDictionary Interface
*/
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
Dictionary<string, string> dict = new Dictionary<string, string>();
dict["Tom"] = "Bob";
WriteKeyA(dict);
SortedDictionary<string, string> sort = new SortedDictionary<string, string>();
sort["Tom"] = "Jerry";
WriteKeyA(sort);
Console.ReadLine();
}
static void WriteKeyA(IDictionary<string, string> i)
{
Console.WriteLine(i["Tom"]);
}
}
/*
Bob
Jerry