B
buzzweetman
Many times I have a Dictionary<string, SomeType> and need to get the
list of keys out of it as a List<string>, to pass to a another method
that expects a List<string>.
I often do the following:
<BEGIN CODE>
List<string> keyNameList = new List<string>();
foreach (string keyName in this.myDictionary.Keys)
{
keyNameList.Add(keyName);
}
someObject.someMethod(keyNameList);
<END CODE>
But it seems like there should be something built-in to give me a List
of the keys.
Am I missing something, or am I doing it the best way?
Thanks
Buzz
list of keys out of it as a List<string>, to pass to a another method
that expects a List<string>.
I often do the following:
<BEGIN CODE>
List<string> keyNameList = new List<string>();
foreach (string keyName in this.myDictionary.Keys)
{
keyNameList.Add(keyName);
}
someObject.someMethod(keyNameList);
<END CODE>
But it seems like there should be something built-in to give me a List
of the keys.
Am I missing something, or am I doing it the best way?
Thanks
Buzz