Remove unnecessary call to ToArray (#16307)

This commit is contained in:
Ilya
2021-10-28 11:22:09 -07:00
committed by GitHub
parent 48be7b7f45
commit 51e11aaedf
2 changed files with 2 additions and 5 deletions
@@ -184,7 +184,7 @@ namespace System.Management.Automation
#endif
// format files
internal static readonly List<string> FormatFileNames = new()
internal static readonly string[] FormatFileNames = new string[]
{
"Certificate.format.ps1xml",
"Diagnostics.format.ps1xml",
@@ -1434,9 +1434,6 @@ namespace System.Management.Automation.Runspaces
return iss;
}
// Porting note: moved to Platform so we have one list to maintain
private static readonly string[] s_PSCoreFormatFileNames = Platform.FormatFileNames.ToArray();
private static void IncludePowerShellCoreFormats(InitialSessionState iss)
{
string psHome = Utils.DefaultPowerShellAppBase;
@@ -1446,7 +1443,7 @@ namespace System.Management.Automation.Runspaces
}
iss.Formats.Clear();
foreach (var coreFormat in s_PSCoreFormatFileNames)
foreach (var coreFormat in Platform.FormatFileNames)
{
iss.Formats.Add(new SessionStateFormatEntry(Path.Combine(psHome, coreFormat)));
}