如何使用指定键从 C# 中的 HashTable 集合中获取值

如何使用指定键从 C# 中的 HashTable 集合中获取值

A hashtable is a collection of key−value pairs. We can access key−value pairs using an iterator. We can also access the keys of the hashtable in a collection. Similarly, we can access the values in a hashtable. Given a hashtable, it is also possible to access the value of a specified key or matching key of a specified value.

让我们讨论一下如何在给定键的哈希表集合中访问一个值。

如何使用指定的键从Hashtable集合中获取值?

Here, we have to obtain a value from the key−value pair of hashtables when a key is given.

考虑以下哈希表。

{“US", "New York"} {"FR", "Paris"} {"UK", "London"} {"IN", "Mumbai"} {"GER", "Berlin"} 登录后复制