mirror of
https://github.com/wagesj45/mdfinder.git
synced 2025-09-09 03:20:38 -05:00
Period Checkin
This commit is contained in:
parent
f81e4f13da
commit
be05120bdb
28 changed files with 1541 additions and 42 deletions
|
|
@ -27,5 +27,20 @@ namespace mdfinder
|
|||
.GroupBy(a => a.i / binSize)
|
||||
.Select(grp => grp.Select(a => a.x));
|
||||
}
|
||||
|
||||
/// <summary> An IEnumerable<T> extension method that returns the first item or a given default value if no items are in the collection. </summary>
|
||||
/// <typeparam name="T"> Generic type parameter. </typeparam>
|
||||
/// <param name="items"> The items to act on. </param>
|
||||
/// <param name="default"> The default. </param>
|
||||
/// <returns> A T. </returns>
|
||||
public static T FirstOr<T>(this IEnumerable<T> items, T @default)
|
||||
{
|
||||
foreach(var t in items)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
return @default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue