timing colours

This commit is contained in:
ntr committed 2023-07-20 16:27:02 +10:00
1 parent 64727058df
commit fc592cd848
3 files changed
+35 -15

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
public static class IEnumerableExtensions {
public static T MinBy<T, K>(this IEnumerable<T> source, Func<T, K> selector) {
T min = default;
bool anyValue = false;
foreach (var item in source) {
if (!anyValue || Comparer<K>.Default.Compare(selector(item), selector(min)) < 0) {
min = item;
anyValue = true;
}
}
return min;
}
}