dotnet add package DiscriminatedUnion --version
NuGet\Install-Package DiscriminatedUnion -Version
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="DiscriminatedUnion" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DiscriminatedUnion --version
#r "nuget: DiscriminatedUnion,"
#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.
// Install DiscriminatedUnion as a Cake Addin
#addin nuget:?package=DiscriminatedUnion&version=

// Install DiscriminatedUnion as a Cake Tool
#tool nuget:?package=DiscriminatedUnion&version=

Implementation of Discriminated Union and Pattern Matching in C#.

string outputValue = x.Match<String>()
.Case(c => c == "Test", v => "It's Test!")
.Case(v => "It's Not Test!")
.Else(() => "It's None!")

var x = new Union<string, int>(100);

// the type annotations below are optional and only added for clerity.
string value = x.Match<string>()
.Case((string v) => v)
.Case((int c) => c == 100, (int v) => "Keeping It 100.")
.Case((int v) => "Tea?")
.Else(() => "Nothing");

Assert.Equal("Keeping It 100.", value);

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DiscriminatedUnion:

Package Downloads

DiscriminatedUnion AutoMap Helper.


DiscriminatedUnion Json Converter

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated 2,600 8/4/2017 1,227 8/4/2017 1,247 7/24/2017