Clean up some ToList usage

This commit is contained in:
jgriff6 2022-10-25 01:40:47 +01:00
parent 5cd37686ac
commit 08e71010ae
3 changed files with 8 additions and 3 deletions

View File

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

View File

@ -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);

View File

@ -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)
{