From 86ca45681dbfd3feadb9e5a6eb782e35b87b5993 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 7 Dec 2020 23:20:58 +0000 Subject: [PATCH] Avoid array allocations from GetDirectories/GetFiles. (#14328) --- .../engine/CommandCompletion/CompletionCompleters.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs index f5c276466..853b79e78 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs @@ -6096,7 +6096,7 @@ namespace System.Management.Automation foreach (var dir in searchPaths) { - foreach (var file in Directory.GetFiles(dir)) + foreach (var file in Directory.EnumerateFiles(dir)) { if (wildcardPattern.IsMatch(Path.GetFileName(file))) {