I believe, I know the answer. But, trying to get a confirmation. If, you do something like:
foreach (string str in Directory.GetFileSystemEntries(path)) { Console.WriteLine(str); }
Instead, of:
string[] directoryEntries = Directory.GetFileSystemEntries(path);
foreach (string str in directoryEntries) { Console.WriteLine(str); }
Directory.GetFileSystemEntries(path), behind the scenes, will only get executed once, correct? I assume it makes, in this case, the necessary string[] and then does it's looping. Has too ...