working with KeyCollection
Posted on 2013-11-13
I'm trying to figure out this dictionary keyCollection stuff. All I want is to get a list of all the keys of a dictionary, which is defined as:
private baseDictionary As Dictionary(Of String, Dictionary(Of String, BasicContainer))
where BasicContainer is a small class. What I don't understand is why baseDictionary.Keys() returns something called a KeyCollection instead of a simple list of string? What's the purpose of that? If I have Dictionary(Of String, Tvalue), then does it really matter what Tvalue is? It could be a million different things, but the keys would all still be string. What is the point of this KeyCollection?
This definition of a strongly type KeyCollection makes no sense to me. How can I get a simple List(OF String) or ArrayList or some basic, sensible collection of strings that represent the dictionary keys?