Hafner.Tools.Enumerable.GetLinearSample
Package "Hafner.Tools.Enumerable.GetLinearSample" contains an extension method for an IEnumerable<T> that returns a linear sample
of the desired number of elements from the collection (or less if the collection does not contain that many elements). Always the first and the last elements
are returned and evenly spaced elements in between. Edge cases:
<li /> If a negative number of samples is requested, an ArgumentOutOfRangeException is thrown.
<li /> If the source list has less elements than samples requested, all elements are returned.
<li /> If the source list is null, an empty List<T> is returned.
<li /> If 0 samples are requested, an empty List<T> is returned.
<li /> If 1 sample is requested, the first element is returned.
<li /> If 2 samples are requested, the first and the last elements are returned.
Assuming a collection contains 100 elements, a call to `collection.GetLinearSample(10)` would return a new List<T> containing the elements at index 0, 11, 22, 33, 44, 55, 66, 77, 88 and 99.
This package supports <br /><li /> .NET framework versions 2.0, 3.0, 3.5, 4.0, 4.0.3, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1<br /><li /> .NET core versions 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0<br /><li /> .NET standard versions 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1<br />
v1.1.1↙ 1.3K