Return either ReadOnlyCollection<T> or T

This page summarizes the projects mentioned and recommended in the original post on /r/dotnet

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • .NET Runtime

    .NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.

  • You want something like a generic version of the StringValues struct ? You can starting from the code here, as the doc says: "Represents zero/null, one, or many strings in an efficient way"

  • OneOf

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

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • csharp-monad

    Library of monads for C#

  • Scala has the construction which you are looking for - Either Monad. It returns one value or another. Dotnet also has the implementation of this construction: https://github.com/louthy/csharp-monad

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts