Hafner.Tools.Enumerable.GetLinearSample 1.1.1

dotnet add package Hafner.Tools.Enumerable.GetLinearSample --version 1.1.1
                    
NuGet\Install-Package Hafner.Tools.Enumerable.GetLinearSample -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hafner.Tools.Enumerable.GetLinearSample" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hafner.Tools.Enumerable.GetLinearSample" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Hafner.Tools.Enumerable.GetLinearSample" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hafner.Tools.Enumerable.GetLinearSample --version 1.1.1
                    
#r "nuget: Hafner.Tools.Enumerable.GetLinearSample, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Hafner.Tools.Enumerable.GetLinearSample&version=1.1.1
                    
Install Hafner.Tools.Enumerable.GetLinearSample as a Cake Addin
#tool nuget:?package=Hafner.Tools.Enumerable.GetLinearSample&version=1.1.1
                    
Install Hafner.Tools.Enumerable.GetLinearSample as a Cake Tool

Hafner.Tools.Enumerable.GetLinearSample

This micro package provides extension method System.Collection.Generic.IEnumerable<T>.GetLinearSample(int count).

Description

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. Always the first and the last elements are returned and evenly spaced elements in between.

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.

Edge cases:

<li /> If a negative number of samples is requested, an <code>ArgumentOutOfRangeException</code> is thrown. <li /> If the source list has less elements than requested samples, all elements are returned. <li /> If the source list is null, an empty <code>List<T></code> is returned. <li /> If 0 samples are requested, an empty <code>List<T></code> 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.

Supported Frameworks:

<li /> .NET framework versions <code>2.0</code>, <code>3.0</code>, <code>3.5</code>, <code>4.0</code>, <code>4.0.3</code>, <code>4.5</code>, <code>4.5.1</code>, <code>4.5.2</code>, <code>4.6</code>, <code>4.6.1</code>, <code>4.6.2</code>, <code>4.7</code>, <code>4.7.1</code>, <code>4.7.2</code>, <code>4.8</code>, <code>4.8.1</code> <li /> .NET core versions <code>1.0</code>, <code>1.1</code>, <code>2.0</code>, <code>2.1</code>, <code>2.2</code>, <code>3.0</code>, <code>3.1</code>, <code>5.0</code>, <code>6.0</code>, <code>7.0</code>, <code>8.0</code>, <code>9.0</code> <li /> .NET standard versions <code>1.0</code>, <code>1.1</code>, <code>1.2</code>, <code>1.3</code>, <code>1.4</code>, <code>1.5</code>, <code>1.6</code>, <code>2.0</code>, <code>2.1</code>

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp1.0 is compatible.  netcoreapp1.1 is compatible.  netcoreapp2.0 is compatible.  netcoreapp2.1 is compatible.  netcoreapp2.2 is compatible.  netcoreapp3.0 is compatible.  netcoreapp3.1 is compatible. 
.NET Standard netstandard1.0 is compatible.  netstandard1.1 is compatible.  netstandard1.2 is compatible.  netstandard1.3 is compatible.  netstandard1.4 is compatible.  netstandard1.5 is compatible.  netstandard1.6 is compatible.  netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net20 is compatible.  net30 is compatible.  net35 is compatible.  net40 is compatible.  net403 is compatible.  net45 is compatible.  net451 is compatible.  net452 is compatible.  net46 is compatible.  net461 is compatible.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Windows Phone wp8 was computed.  wp81 was computed.  wpa81 was computed. 
Windows Store netcore was computed.  netcore45 was computed.  netcore451 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 1.0

  • .NETCoreApp 1.1

  • .NETCoreApp 2.0

    • No dependencies.
  • .NETCoreApp 2.1

    • No dependencies.
  • .NETCoreApp 2.2

    • No dependencies.
  • .NETCoreApp 3.0

    • No dependencies.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 2.0

  • .NETFramework 3.0

  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.0.3

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.5.1

    • No dependencies.
  • .NETFramework 4.5.2

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETFramework 4.8.1

    • No dependencies.
  • .NETStandard 1.0

  • .NETStandard 1.1

  • .NETStandard 1.2

  • .NETStandard 1.3

  • .NETStandard 1.4

  • .NETStandard 1.5

  • .NETStandard 1.6

  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 185 4/17/2025
1.1.0 184 4/17/2025
1.0.3 159 4/6/2025
1.0.2 152 4/6/2025
1.0.1 161 4/6/2025

License added (MIT).