mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-21 22:25:03 -04:00
New: (Indexer) BitHDTV
This commit is contained in:
@@ -160,5 +160,16 @@ namespace NzbDrone.Common.Extensions
|
||||
{
|
||||
return new HashSet<T>(source, comparer);
|
||||
}
|
||||
|
||||
public static T FirstIfSingleOrDefault<T>(this IEnumerable<T> source, T replace = default)
|
||||
{
|
||||
if (source is ICollection<T> collection)
|
||||
{
|
||||
return collection.Count == 1 ? collection.First() : replace;
|
||||
}
|
||||
|
||||
var test = source.Take(2).ToList();
|
||||
return test.Count == 1 ? test[0] : replace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user