Dictionary<string, DirectoryInfo>
Implements
IEnumerable<KeyValuePair<string, DirectoryInfo>>
This means that the foreach loop cyclically completes the KeyValuePair<string, DirectoryInfo> objects:
foreach(KeyValuePair<string, DirectoryInfo> kvp in myDirectoryList) { }
Also why any of the IEnumerable extension methods will always work with the KeyValuePair object:
// Get all key/value pairs where the key starts with C:\ myDirectoryList.Where(kvp => kvp.Key.StartsWith("C:\\"));
Justin niessner
source share