Which code segment should you use?

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?

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?

A.
class MyDictionary : Dictionary<string, string>

B.
class MyDictionary : HashTable

C.
class MyDictionary : IDictionary

D.
class MyDictionary {

} Dictionary<string, string> t = new Dictionary<string, string>();
MyDictionary dictionary = (MyDictionary)t;



Leave a Reply 0

Your email address will not be published. Required fields are marked *