// Create a new HybridDictionary HybridDictionary dict = new HybridDictionary(); // Add some items to the collection dict["key1"] = "value1"; dict["key2"] = "value2"; dict["key3"] = "value3"; // Retrieve a value from the collection string value = dict["key2"] as string; Console.WriteLine(value); // prints "value2"
// Create a new HybridDictionary HybridDictionary dict = new HybridDictionary(); // Add some items to the collection dict["key1"] = "value1"; dict["key2"] = "value2"; dict["key3"] = "value3"; // Enumerate over the collection and print the key-value pairs foreach (DictionaryEntry entry in dict) { Console.WriteLine("{0}: {1}", entry.Key, entry.Value); } // prints "key1: value1", "key2: value2", "key3: value3"This class is part of the System.Collections.Specialized namespace in .NET Framework, which provides a collection of specialized and strongly-typed collection classes and structures.