mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove unnecessary call to ToArray (#16307)
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user