239 packages tagged with “union”
ExhaustiveMatching.Analyzer adds exhaustive matching to C# switch statements and expressions. Get compiler errors for missing cases in a switch statement or expression. Mark which switches should have exhaustiveness checking by throwing an exception in the default case. Exhaustiveness checking works not just for enums, but for classes and interfaces. Turn them into discriminated unions (aka sum types) by marking them with the 'Closed' attribute and listing the cases. ExhaustiveMatching.Analyzer goes beyond what other languages support by handling full inheritance hierarchies.
Immutable persistent collections, algebraic sum-type aka descriminated union, Ref type and supportive extensions for performant functional programming in C#. Split from the DryIoc: https://github.com/dadhi/DryIoc
Polygon Clipping and Offsetting Library
C# source generator to generate efficient and type-safe variant types for unmanaged types.
A simple source generator for discriminated unions in C#.
The Clipper library performs clipping and offsetting for both lines and polygons. All four boolean clipping operations are supported - intersection, union, difference and exclusive-or. Polygons can be of any shape including self-intersecting polygons.
Union typing is only needed when you have a statically typed language, as you need to declare that an object can return one of multiple types (in your case an int or string , or in the other example string or null)
This package helps to serialize .NET/C# classes hierarchy as a tagged union (also known as a discriminated union).
CodeJam is a set of handy reusable .NET components that can simplify your daily work and save your time when you copy and paste your favorite helper methods and classes from one project to another.
A type-safe and space-efficient sum type for C# (comparable to unions in C or C++)
A bunch of useful extension methods
Simple discriminated union types (till they are officially supported)
Contains the attributes for the nuget package CSharpDiscriminatedUnion
A collection of ErrorOr extension methods designed to reduce the amount of boilerplate code needed when returning appropriate HTTP responses.
Portable library for easy to use F#-like Discriminated Unions in C#. Implicitly casts objects into OneOf instances, then use .Match extension to do pattern matching. Designed as a partial drop in replacement for OneOf.
A source generator that generates `Match` methods for all your discriminated unions needs. ✨
NCommons is a set of several .NET libraries which provide common building blocks that can be used by any kind of library or application. This library provides several members which assist in writing type-safe and expressive code. Even though the package is called "Monads", the included members don't necessarily have to be monadic. In general, the goal of the package is to provide utility types, monadic or not, which assist in writing precise code that still looks and behaves like traditional C#. While inspired by functional programming languages, the provided types still look and feel like types that could come straight from the .NET Framework's BCL. Commonly Used Types: Optional<T> Variant<T1>, ..., Variant<T1,...,T8> You can find additional information and documentation on the library's GitHub page: https://github.com/manuelroemer/NCommons
Provides support polymorphic types in C#, such as Covariant and Invariant Maybe (Optional) types, and type unions.
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!") or 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);
Package Description
An union type for c#. Powerful, low consumption, and highly scalable type for c#.
Provide CQRS, MediatR, Pipelines, DTOs, and more for the Application Layer.
A C# functional library which includes Option, Result, Union, and other helpful abstractions.
Creates discriminated unions in C#. Define a template for a discriminated union and the appropriate code will be generated.
An implementation of a discriminated union data structure with pattern matching support.
Provides a set of extension members for commonly used types within .Net (C#) to enable writing code fluently. Also adds support for different patterns like the option or result pattern (unions) and further enhances .Net features like LINQ by adding more methods and overloads to existing methods as well as bringing promise like extensions to .Net Tasks.
Boolean operations on polygons (union, intersection, difference, xor) in .NET
A source generator for creating C# union types via a generic marker attribute.