98-372 · Question #98
In which of the following types of objects is a Hashtable collection used to store its entries?
The correct answer is D. DictionaryEntry. The Hashtable collection is used to store entries in DictionaryEntry objects. The DictionaryEntry structure is used to define a dictionary key/value pair that can be set or retrieved. The Entry method of the IDictionaryEnumerator structure returns an instance of this type. The…
Question
In which of the following types of objects is a Hashtable collection used to store its entries?
Options
- AStack
- BDictionaryBase
- CQueue
- DDictionaryEntry
How the community answered
(23 responses)- A4% (1)
- B13% (3)
- C4% (1)
- D78% (18)
Explanation
The Hashtable collection is used to store entries in DictionaryEntry objects. The DictionaryEntry structure is used to define a dictionary key/value pair that can be set or retrieved. The Entry method of the IDictionaryEnumerator structure returns an instance of this type. The foreach statement of the C# language needs the type of each element in the collection. Since each element of IDictionary is a key/value pair, the element type is not the type of the key or value. Instead, the element type is DictionaryEntry.
Topics
Community Discussion
No community discussion yet for this question.