Dim dictionaryTest As New SortedDictionary(Of Integer, MyClass)
Answer is replace
Dim enumerator As IEnumerator(Of Integer, MyClass) = dictionaryTest.GetEnumerator() '<- not possible.
with
Dim enumerator As IEnumerator(Of KeyValuePair(Of Integer, Myclass)) = dictionaryTest.GetEnumerator()