aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Extensions/CollectionExtensions.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2019-09-20 12:42:08 +0200
committerBond_009 <bond.009@outlook.com>2019-09-23 20:32:44 +0200
commitc9820d30edf1cb8fa99a52ec72b6571d6d4506f7 (patch)
tree9a479536e6d18d3a2e9a8d253c4d3846d3d2aceb /MediaBrowser.Common/Extensions/CollectionExtensions.cs
parentb8fd6a7ec3e49298ffacc6da96d59ae03a593cd3 (diff)
Fix multiple mistakes and warnings
Diffstat (limited to 'MediaBrowser.Common/Extensions/CollectionExtensions.cs')
-rw-r--r--MediaBrowser.Common/Extensions/CollectionExtensions.cs19
1 files changed, 17 insertions, 2 deletions
diff --git a/MediaBrowser.Common/Extensions/CollectionExtensions.cs b/MediaBrowser.Common/Extensions/CollectionExtensions.cs
index 3bc0295a0..75b9f59f8 100644
--- a/MediaBrowser.Common/Extensions/CollectionExtensions.cs
+++ b/MediaBrowser.Common/Extensions/CollectionExtensions.cs
@@ -5,13 +5,28 @@ 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)
+ public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
{
dictionary.TryGetValue(key, out var ret);
return ret;
}
- // REVIEW: Inline?
+ /// <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.