Browse Source

Clean up some ToList usage

jgriff6 2 years ago
parent
commit
08e71010ae

+ 2 - 1
Emby.Naming/AudioBook/AudioBookListResolver.cs

@@ -101,7 +101,8 @@ namespace Emby.Naming.AudioBook
                         {
                         {
                             var extra = ex
                             var extra = ex
                                 .OrderBy(x => x.Container)
                                 .OrderBy(x => x.Container)
-                                .ThenBy(x => x.Path);
+                                .ThenBy(x => x.Path)
+                                .ToList();
 
 
                             stackFiles = stackFiles.Except(extra).ToList();
                             stackFiles = stackFiles.Except(extra).ToList();
                             extras.AddRange(extra);
                             extras.AddRange(extra);

+ 4 - 1
Emby.Server.Implementations/Collections/CollectionManager.cs

@@ -232,7 +232,10 @@ namespace Emby.Server.Implementations.Collections
 
 
             if (list.Count > 0)
             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);
                 collection.UpdateRatingToItems(linkedChildrenList);
 
 
                 await collection.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
                 await collection.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);

+ 2 - 1
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -615,7 +615,8 @@ namespace Emby.Server.Implementations.Library
                 .Distinct(StringComparer.OrdinalIgnoreCase)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
                 .ToList();
                 .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)
             foreach (var dupe in dupes)
             {
             {