mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Added MinOrDefault for IEnumberable<int>
This commit is contained in:
@@ -57,7 +57,7 @@ namespace NzbDrone.Core
|
||||
{
|
||||
var intList = ints.ToList();
|
||||
|
||||
if (intList.Count() == 0)
|
||||
if (!intList.Any())
|
||||
return 0;
|
||||
|
||||
return intList.Max();
|
||||
@@ -142,5 +142,15 @@ namespace NzbDrone.Core
|
||||
|
||||
return String.Format("{0:N" + precision + "} {1}", size, suffix);
|
||||
}
|
||||
|
||||
public static int MinOrDefault(this IEnumerable<int> ints)
|
||||
{
|
||||
var intsList = ints.ToList();
|
||||
|
||||
if (!intsList.Any())
|
||||
return 0;
|
||||
|
||||
return intsList.Min();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user