mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
Reformat and apply Stylecop rules
This commit is contained in:
@@ -13,8 +13,10 @@ namespace NzbDrone.Common.Extensions
|
||||
return source.Where(element => knownKeys.Add(keySelector(element)));
|
||||
}
|
||||
|
||||
public static IEnumerable<TFirst> IntersectBy<TFirst, TSecond, TKey>(this IEnumerable<TFirst> first, Func<TFirst, TKey> firstKeySelector,
|
||||
IEnumerable<TSecond> second, Func<TSecond, TKey> secondKeySelector,
|
||||
public static IEnumerable<TFirst> IntersectBy<TFirst, TSecond, TKey>(this IEnumerable<TFirst> first,
|
||||
Func<TFirst, TKey> firstKeySelector,
|
||||
IEnumerable<TSecond> second,
|
||||
Func<TSecond, TKey> secondKeySelector,
|
||||
IEqualityComparer<TKey> keyComparer)
|
||||
{
|
||||
var keys = new HashSet<TKey>(second.Select(secondKeySelector), keyComparer);
|
||||
@@ -31,9 +33,11 @@ namespace NzbDrone.Common.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<TFirst> ExceptBy<TFirst, TSecond, TKey>(this IEnumerable<TFirst> first, Func<TFirst, TKey> firstKeySelector,
|
||||
IEnumerable<TSecond> second, Func<TSecond, TKey> secondKeySelector,
|
||||
IEqualityComparer<TKey> keyComparer)
|
||||
public static IEnumerable<TFirst> ExceptBy<TFirst, TSecond, TKey>(this IEnumerable<TFirst> first,
|
||||
Func<TFirst, TKey> firstKeySelector,
|
||||
IEnumerable<TSecond> second,
|
||||
Func<TSecond, TKey> secondKeySelector,
|
||||
IEqualityComparer<TKey> keyComparer)
|
||||
{
|
||||
var keys = new HashSet<TKey>(second.Select(secondKeySelector), keyComparer);
|
||||
var matchedKeys = new HashSet<TKey>();
|
||||
@@ -62,6 +66,7 @@ namespace NzbDrone.Common.Extensions
|
||||
result[key] = item;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -76,6 +81,7 @@ namespace NzbDrone.Common.Extensions
|
||||
result[key] = valueSelector(item);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -112,11 +118,15 @@ namespace NzbDrone.Common.Extensions
|
||||
public static IEnumerable<T> DropLast<T>(this IEnumerable<T> source, int n)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("n",
|
||||
"Argument n should be non-negative.");
|
||||
}
|
||||
|
||||
return InternalDropLast(source, n);
|
||||
}
|
||||
@@ -130,9 +140,12 @@ namespace NzbDrone.Common.Extensions
|
||||
buffer.Enqueue(x);
|
||||
|
||||
if (buffer.Count == n + 1)
|
||||
{
|
||||
yield return buffer.Dequeue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool In<T>(this T source, List<T> list)
|
||||
{
|
||||
return list.Contains(source);
|
||||
|
||||
Reference in New Issue
Block a user