aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Extensions/CollectionExtensions.cs
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2019-11-04 10:03:18 -0500
committerAndrew Mahone <andrew.mahone@gmail.com>2019-11-04 10:03:18 -0500
commit1600d5b53f89ad4f1af39a6a53d0ef251341b278 (patch)
tree12f5483eba2396ad9b8da2e46f6a0ced073cf5e7 /MediaBrowser.Common/Extensions/CollectionExtensions.cs
parent90dfe729bb9f8929bf584b93f93aabd84abbef3d (diff)
parent9756bdb76ea625c19b6743a34ec95759d3f6d050 (diff)
Merge remote-tracking branch 'origin/master' into media-attachments-clean
Diffstat (limited to 'MediaBrowser.Common/Extensions/CollectionExtensions.cs')
-rw-r--r--MediaBrowser.Common/Extensions/CollectionExtensions.cs48
1 files changed, 0 insertions, 48 deletions
diff --git a/MediaBrowser.Common/Extensions/CollectionExtensions.cs b/MediaBrowser.Common/Extensions/CollectionExtensions.cs
deleted file mode 100644
index 215224398..000000000
--- a/MediaBrowser.Common/Extensions/CollectionExtensions.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-#pragma warning disable CS1591
-
-using System.Collections.Generic;
-
-namespace MediaBrowser.Common.Extensions
-{
- // The MS CollectionExtensions are only available in netcoreapp
- public static class CollectionExtensions
- {
- public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
- {
- dictionary.TryGetValue(key, out var ret);
- return ret;
- }
-
- /// <summary>
- /// Copies all the elements of the current collection to the specified list
- /// starting at the specified destination array index. The index is specified as a 32-bit integer.
- /// </summary>
- /// <param name="source">The current collection that is the source of the elements.</param>
- /// <param name="destination">The list that is the destination of the elements copied from the current collection.</param>
- /// <param name="index">A 32-bit integer that represents the index in <c>destination</c> at which copying begins.</param>
- /// <typeparam name="T"></typeparam>
- public static void CopyTo<T>(this IReadOnlyList<T> source, IList<T> destination, int index = 0)
- {
- for (int i = 0; i < source.Count; i++)
- {
- destination[index + i] = source[i];
- }
- }
-
- /// <summary>
- /// Copies all the elements of the current collection to the specified list
- /// starting at the specified destination array index. The index is specified as a 32-bit integer.
- /// </summary>
- /// <param name="source">The current collection that is the source of the elements.</param>
- /// <param name="destination">The list that is the destination of the elements copied from the current collection.</param>
- /// <param name="index">A 32-bit integer that represents the index in <c>destination</c> at which copying begins.</param>
- /// <typeparam name="T"></typeparam>
- public static void CopyTo<T>(this IReadOnlyCollection<T> source, IList<T> destination, int index = 0)
- {
- foreach (T item in source)
- {
- destination[index++] = item;
- }
- }
- }
-}