DestructureExtensions
Destructuring extension methods for awesome C#
Quickstart
In C# 7.0:
using DestructureExtensions;
/*...*/
var stringToSplit = "foo,bar,bam,baz";
var (first, _, third, rest) = stringToSplit.Split(',');
// first == "foo"
// third == "bam"
// rest == IEnumerable<string> containing "baz"
var one = Task.FromResult(1);
var two = Task.FromResult("foo");
var three = Task.FromResult(DateTimeOffset.Now);
var (first, second, third) = await (one, two, three).WhenAll();
var tasks = Enumerable.Range(1, 10).Select(Task.FromResult);
var results = await tasks.WhenAll();
var dictionary = new Dictionary<string, int>()
{
{ "one", 1 },
{ "two", 2 },
{ "three", 3 },
}
foreach (var (key, value) in dictionary)
{
// ...
}More examples in the unit tests.
Building
Ensure you have installed .NET Core
To build a local/development NuGet package, run the following:
dotnet restore
dotnet build
dotnet packThis will produce bin/Debug/DestructureExtensions.0.0.0.nupkg.
Code of Conduct
We are committed to fostering an open and welcoming environment. Please read our code of conduct before participating in or contributing to this project.
Contributing
We welcome contributions and collaboration on this project. Please read our contributor's guide to understand how best to work with us.
License and Authors
This software is made available by Daniel James under the MIT license.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
