aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2024-04-30 21:32:59 +0200
committerGitHub <noreply@github.com>2024-04-30 13:32:59 -0600
commit3feb3f81bfe848aa829e7c129bee3cd060c23c05 (patch)
treec247db8e30d1cc52bc6735d45d86eff8955ee7e9 /Emby.Server.Implementations/Library/LibraryManager.cs
parent5dc6bb4910cfdc7f40ad83d647172d743e6e0595 (diff)
More efficient array creation (#11468)
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs9
1 files changed, 2 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 3e41a5048..3b5714f8e 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -3038,9 +3038,7 @@ namespace Emby.Server.Implementations.Library
{
var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath);
- var list = libraryOptions.PathInfos.ToList();
- list.Add(pathInfo);
- libraryOptions.PathInfos = list.ToArray();
+ libraryOptions.PathInfos = [..libraryOptions.PathInfos, pathInfo];
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
@@ -3059,8 +3057,7 @@ namespace Emby.Server.Implementations.Library
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
- var list = libraryOptions.PathInfos.ToList();
- foreach (var originalPathInfo in list)
+ foreach (var originalPathInfo in libraryOptions.PathInfos)
{
if (string.Equals(mediaPath.Path, originalPathInfo.Path, StringComparison.Ordinal))
{
@@ -3069,8 +3066,6 @@ namespace Emby.Server.Implementations.Library
}
}
- libraryOptions.PathInfos = list.ToArray();
-
CollectionFolder.SaveLibraryOptions(virtualFolderPath, libraryOptions);
}