Multiple choice technology databases

You are creating a custom dictionary. Which code segment makes sure that the dictionary is type safe

  1. Class MyDictionary Implements Dictionary(Of String, String)

  2. Class MyDictionary Inherits HashTable

  3. Class MyDictionary Implements IDictionary

  4. Class MyDictionary End Class Dim t As New Dictionary(Of String, String) Dim dict As MyDictionary = CType(t, MyDictionary)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Using 'Implements Dictionary(Of String, String)' creates a type-safe dictionary in .NET. Generic Dictionary with specific type parameters ensures compile-time type checking. HashTable is not type-safe (stores Object), and the non-generic IDictionary interface also allows type violations.