Skip to content

Repository files navigation

DestructureExtensions

Destructuring extension methods for awesome C#

Quickstart

In C# 7.0:

usingDestructureExtensions;/*...*/varstringToSplit="foo,bar,bam,baz";var(first, _,third,rest)=stringToSplit.Split(',');// first == "foo"// third == "bam"// rest == IEnumerable<string> containing "baz"varone=Task.FromResult(1);vartwo=Task.FromResult("foo");varthree=Task.FromResult(DateTimeOffset.Now);var(first,second,third)=await(one,two,three).WhenAll();vartasks=Enumerable.Range(1,10).Select(Task.FromResult);varresults=awaittasks.WhenAll();vardictionary=newDictionary<string,int>(){{"one",1},{"two",2},{"three",3},}foreach(var(key,value)indictionary){// ...}

More examples in the unit tests.

Building

TravisNuGet

Ensure you have installed .NET Core

To build a local/development NuGet package, run the following:

dotnet restore
dotnet build
dotnet pack

This 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

Daniel James logo Daniel James

licenseGitHub contributors

This software is made available by Daniel James under the MIT license.

About

Destructuring extension methods for awesome C#

Topics

Resources

Code of conduct

Contributing

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages