←Go Back to Online Practice Test
Ques. You are writing a custom dictionary. The custom-dictionary class is named MyDictionary. You need to ensure that the dictionary is type
safe.
Which code segment should you use?
Option 1. class MyDictionary : Dictionary<string, string>
Option 2. class MyDictionary : HashTable
Option 3. class MyDictionary : IDictionary
Option 4. class MyDictionary { ... } Dictionary<string, string> t = new Dictionary<string, string>(); MyDictionary dictionary = (MyDictionary)t;
Ans. Option 4
Please provide the reason below. The best provided reason will be displayed with your name(if you are logged-in) on website.
Enter Reason
 
Is it helpful? Yes No