aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/Extensions.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-09-02 08:19:29 +0200
committerAnthony Lavado <anthonylavado@users.noreply.github.com>2019-09-02 02:19:29 -0400
commitee637e8fecbcefe429babbbbd1325bce7c3fe991 (patch)
treee3d76fb8d753dd43d8d0cff16e199b706ba84980 /MediaBrowser.Controller/Entities/Extensions.cs
parentcb393c215a2ea75f61d0e3e798c6a4a596d720c2 (diff)
Fix warnings, improve performance (#1665)
* Fix warnings, improve performance `QueryResult.Items` is now a `IReadOnlyList` so we don't need to allocate a new `Array` when we have a `List` (and `Items` shouldn't need to be mutable anyway) * Update Providers .csproj to latest C# * Remove extra newline from DtoService.cs * Remove extra newline from UserLibraryService.cs
Diffstat (limited to 'MediaBrowser.Controller/Entities/Extensions.cs')
-rw-r--r--MediaBrowser.Controller/Entities/Extensions.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.cs
index f3bddd29c..d2ca11740 100644
--- a/MediaBrowser.Controller/Entities/Extensions.cs
+++ b/MediaBrowser.Controller/Entities/Extensions.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities
@@ -28,13 +29,17 @@ namespace MediaBrowser.Controller.Entities
Url = url
};
- if (item.RemoteTrailers.Length == 0)
+ if (item.RemoteTrailers.Count == 0)
{
item.RemoteTrailers = new[] { mediaUrl };
}
else
{
- item.RemoteTrailers = item.RemoteTrailers.Concat(new[] { mediaUrl }).ToArray();
+ var oldIds = item.RemoteTrailers;
+ var newIds = new MediaUrl[oldIds.Count + 1];
+ oldIds.CopyTo(newIds);
+ newIds[oldIds.Count] = mediaUrl;
+ item.RemoteTrailers = newIds;
}
}
}