programming-examples/c-sharp/Inheritance_&_Interface/C# Program to Demonstrate iDictionary Interface.cs

28 lines
610 B
C#
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* 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