From 08e71010ae3370cb51068eb0215d53f82019fbca Mon Sep 17 00:00:00 2001 From: jgriff6 <74262798+jgriff6@users.noreply.github.com> Date: Tue, 25 Oct 2022 01:40:47 +0100 Subject: Clean up some ToList usage --- Emby.Server.Implementations/Collections/CollectionManager.cs | 5 ++++- Emby.Server.Implementations/Library/LibraryManager.cs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs index 213c3dccc..187e0c9b3 100644 --- a/Emby.Server.Implementations/Collections/CollectionManager.cs +++ b/Emby.Server.Implementations/Collections/CollectionManager.cs @@ -232,7 +232,10 @@ namespace Emby.Server.Implementations.Collections if (list.Count > 0) { - collection.LinkedChildren = collection.LinkedChildren.Concat(list).ToArray(); + LinkedChild[] newChildren = new LinkedChild[collection.LinkedChildren.Length + list.Count]; + collection.LinkedChildren.CopyTo(newChildren, 0); + list.CopyTo(newChildren, collection.LinkedChildren.Length); + collection.LinkedChildren = newChildren; collection.UpdateRatingToItems(linkedChildrenList); await collection.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index c2a1f4dde..cef82ebbc 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -615,7 +615,8 @@ namespace Emby.Server.Implementations.Library .Distinct(StringComparer.OrdinalIgnoreCase) .ToList(); - var dupes = list.Where(subPath => !subPath.EndsWith(":\\", StringComparison.OrdinalIgnoreCase) && list.Any(i => _fileSystem.ContainsSubPath(i, subPath))); + var dupes = list.Where(subPath => !subPath.EndsWith(":\\", StringComparison.OrdinalIgnoreCase) && list.Any(i => _fileSystem.ContainsSubPath(i, subPath))) + .ToList(); foreach (var dupe in dupes) { -- cgit v1.2.3