# mcintyre321/OneOf

Easy to use F#-like ~discriminated~ unions for C# with exhaustive compile time matching

Repository: https://github.com/mcintyre321/OneOf
Canonical: https://ross.abutalabs.com/products/oneof
Language: C#
License: MIT
License Family: permissive
Topics: discriminated-unions, c-sharp, f-sharp, dotnetcore
Last push: 2026-06-11T20:22:18+00:00

## Health v2 (maintenance only)
Score: 71/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 87, release rhythm 35, longevity 100
- inputs: {"age_days": 3886, "days_push": 83, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4054, forks 164 (observed 2026-08-28T04:08:33.896753+00:00)

## What it is
OneOf is a C# library providing F#-style discriminated unions via a generic OneOf<T0,...,Tn> type with exhaustive compile-time matching. It lets methods return strongly typed alternative outcomes without exceptions or base-class hierarchies.

## Use cases
- return multiple typed results from a c# method
- avoid exceptions for control flow
- implement option/maybe types in c#
- exhaustive compile-time checked switch handling
- model success or error outcomes with strong types

## When to choose
- you write C# and want F#-like discriminated unions
- you want method signatures that force callers to handle every outcome
- you want to replace exception-based control flow with typed error values

## When to avoid
- you work outside the .NET ecosystem
- your team prefers traditional polymorphism or exception handling
- you need runtime-open unions with dynamically extensible cases

## Facets
- artifact type: library
- maturity: active
- function: type-system, error-handling
- domain: programming-languages, developer-tools
- platform: dotnet, cross-platform
- tags: discriminated-unions, csharp, result-types, pattern-matching, functional-programming

## Member repositories
- mcintyre321/OneOf (main) score 71

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:33.896753+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:23:38.257866+00:00, confidence not recorded.
  - readme: https://github.com/mcintyre321/OneOf (fetched 2026-08-28T04:08:33.896753+00:00, sha 6d02ea4fba6e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
