Bob Jerry
Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
C# Program to Demonstrate the iDictionary Interface
C# Program to Demonstrate the iDictionary Interface
This is a C# Program to demonstrate idictionary interface.
This C# Program Demonstrates iDictionary Interface.
Here this program uses both the Dictionary and SortedDictionary types. Suppose that you want to add some functionality that can work on an instance of Dictionary or an instance of SortedDictionary.
Here is source code of the C# Program to Demonstrate iDictionary Interface. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * 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"]); } }
This C# program is used to demonstrate the IDictionary interface. This program uses both the Dictionary and SortedDictionary types. To add some functionality that can work on an instance of Dictionary or an instance of SortedDictionary.
It can be used in an elaborate implementation of a custom dictionary. It can also be used in simpler programs that act upon different dictionary types including Dictionary and SortedDictionary.
The Dictionary implements the IDictionary interface. SortedDictionary implements IDictionary. In Console.WriteLine(i[“Tom”]) by using instance through IDictionary interface.