SawNaw.LinqExtensions.EnumerableSplit 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SawNaw.LinqExtensions.EnumerableSplit --version 1.0.2
                    
NuGet\Install-Package SawNaw.LinqExtensions.EnumerableSplit -Version 1.0.2
                    
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="SawNaw.LinqExtensions.EnumerableSplit" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SawNaw.LinqExtensions.EnumerableSplit" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="SawNaw.LinqExtensions.EnumerableSplit" />
                    
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 SawNaw.LinqExtensions.EnumerableSplit --version 1.0.2
                    
#r "nuget: SawNaw.LinqExtensions.EnumerableSplit, 1.0.2"
                    
#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.
#:package SawNaw.LinqExtensions.EnumerableSplit@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SawNaw.LinqExtensions.EnumerableSplit&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=SawNaw.LinqExtensions.EnumerableSplit&version=1.0.2
                    
Install as a Cake Tool

LINQ extension to split a collection into several.

Think of it as String.Split() for collections.<br />

Example: Split a collection by specifying the splitters.

string[] things = { "pie", "apple", "cake", "mud-pie", "nuts", "plum", "mud-spread", "milk", "butter" };

// Literally specify the splitters.
var edibleThings = things.Split("mud-pie", "mud-spread");

edibleThings will contain these collections: <br /> {"pie", "apple", "cake"}<br /> {"nuts", "plum"}<br /> {"milk", "butter"}<br />

Example: Split a collection by using a function to define the splitter.

string[] things = { "pie", "apple", "cake", "mud-pie", "nuts", "plum", "mud-spread", "milk", "butter" };

// Specify a function to define the splitters.
var edibleThings = things.Split(t => t.StartsWith("mud"));

edibleThings will contain these collections: <br /> {"pie", "apple", "cake"}<br /> {"nuts", "plum"}<br /> {"milk", "butter"}

Use Cases

Any time a collection contains useful information separated by known elements.<br /><br /> For example, a text file may contain records where each record is separated by a newline. <br /> Simply read the text file, and perform a Split(), passing in the condition for the split.

string[] fileContents = File.ReadAllLines("records.txt");
var individualRecords = fileContents.Split(x => string.IsNullOrWhiteSpace(x));
Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.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.0.5 383 1/26/2023
1.0.4 343 1/26/2023
1.0.3 355 1/26/2023
1.0.2 335 1/26/2023

Initial release