8000 Avoid array allocations from GetDirectories/GetFiles. (#15167) · awakecoding/PowerShell@4e073fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e073fd

Browse files
authored
Avoid array allocations from GetDirectories/GetFiles. (PowerShell#15167)
1 parent 33d1c12 commit 4e073fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/System.Management.Automation/help/HelpFileHelpProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ internal Collection<string> GetExtendedSearchPaths()
368368
{
369369
// Get all the directories under the module path
370370
// * and SearchOption.AllDirectories gets all the version directories.
371-
string[] directories = Directory.GetDirectories(psModulePath, "*", SearchOption.AllDirectories);
371+
IEnumerable<string> directories = Directory.EnumerateDirectories(psModulePath, "*", SearchOption.AllDirectories);
372372

373373
var possibleModuleDirectories = directories.Where(static directory => !ModuleUtils.IsPossibleResourceDirectory(directory));
374374

0 commit comments

Comments
 (0)
0