Lyo.Result 2.0.0

dotnet add package Lyo.Result --version 2.0.0
                    
NuGet\Install-Package Lyo.Result -Version 2.0.0
                    
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="Lyo.Result" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Result" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.Result" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lyo.Result --version 2.0.0
                    
#r "nuget: Lyo.Result, 2.0.0"
                    
#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.
#:package Lyo.Result@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lyo.Result&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Result&version=2.0.0
                    
Install as a Cake Tool

Lyo.Result

Result / Result<T> and related types. Distinct from Lyo.Common.Core Result (different namespace and design). Feature libraries pick Lyo.Result when they want Error graphs, builders, bulk/paged envelopes, and Task composition without pulling the whole API layer.

Result<T> and IResult<T>

  • Data, IsSuccess, Timestamp, Errors, Metadata (optional key/value bag on ResultBase).
  • Factory methods. Result<T>.Success(...), Failure(Error), Failure(IReadOnlyList<Error>), Failure(message, code, …), Failure(Exception, …).
  • Unwrap / extract. ValueOrThrow, TryGetValue, ValueOrDefault, Match, MapAsync / Map, Tap side effects, boolean operators where defined on the record.

Error

Error is an immutable record with Code, Message, Type, and Severity (ErrorType: Validation, Generic, Conflict, NotFound, Unauthorized, and more). It also has Exception, StackTrace, InnerError (chained errors mimic exception chains), Timestamp, and Metadata. Factory helpers on Error include Validation, FromException, Conflict, NotFound, and Unauthorized, so call sites do not hand-roll severity/type for common cases. Validation-specific codes often flow through ValidationErrorCodes.

Success with no data, and void

  • ResultVoid covers operation completed, no payload, alongside Result<T> (see ResultVoid.cs).
  • Unit is a typed no-value placeholder where APIs want Result<Unit>.

Option<T>

A missing value is not a failed operation. That is what Option is for, and it is not Result. Typical case: an optional query row.

Builders

  • ResultBuilder<T>. Fluent WithFailure / WithSuccess / AddError / WithMetadata / Build().
  • BulkResultBuilder. Accumulate many item-level outcomes into BulkResult.
  • ErrorBuilder. Compose Error graphs (metadata, nested inner errors).

Results paired with the request

  • Result<TRequest, TResult>. Extends Result<TResult> with the original TRequest payload, so failure paths can echo back the input that produced the error. Adds TryGetRequest, a four-tuple Deconstruct, and request-aware Failure(Exception, …) / Success factories.
  • BulkResult<TRequest, TResult>. Bulk variant whose SuccessfulResults, Results, and FailedResults collections are paired (Result<TRequest, TResult>), plus FailedRequests / SuccessfulRequests projections for re-driving partial failures.
  • BulkResultFromRequest<TRequest, TResult>. A single request that expands into many per-item results (e.g. one upload to many row outcomes), with FromResults, FromData, FromException, and FromErrors helpers.

Paging and lists

  • BulkResult<T>. Many operations in one round-trip with cached FailureCount / SuccessCount, IsCompleteFailure / IsCompleteSuccess / HasPartialSuccess flags, ErrorMessages / ErrorCodes (flattened over inner errors), FailedData / SuccessfulData, and FromData / FromResults / FromErrors factories.
  • PagedResult. Items as a Result envelope plus page metadata.

Composition on async paths

AsyncResultExtensions provides ThenAsync (chain Task<Result<…>> only on success), OnFailureAsync / OnSuccessAsync, overloads that propagate CancellationToken, and adapters from Task plus exceptions into Result. Use these to keep async pipelines linear without nested if (!result.IsSuccess) return ….

Validation and guards

ValidationHelpers and Ensure express preconditions and collect validation failures into Result / Error shapes (see XML docs on each file).

Adapters from exception to Result

Adapters on ExceptionExtensions for code that throws:

Extension Purpose
Exception.ToResult<T>(code?) Wraps an exception as Result<T>.Failure(exception, code).
Task<T>.ToResultAsync<T>(code?) Awaits the task; success → Result<T>.Success, exception → Result<T>.Failure.
Task<Result<T>>.ToResultAsync<T>(code?) Awaits a result-returning task and converts thrown exceptions into a failed Result<T>.

Logging

ResultLoggingExtensions attach log scopes for failure and success that carry the same fields your logging config can correlate.

Infrastructure / regex

RegexPatterns hosts shared validation patterns used by higher layers (route slugs, emails, and similar). Check call sites before assuming a specific regex is the product rule.

How this relates to encryption and HTTP

  • Lyo.Encryption ships DecryptionResult / EncryptionResult models in this namespace for operations that want Result without throwing for routine failure modes.
  • SMS and translation envelope stacks reference Lyo.Result for Error typing in their public models.
  • Often returns structured failures compatible with richer error handling in hosts: Lyo.Validation.
  • Guard helpers shared with keystore and validation stacks: Lyo.Exceptions.

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Exceptions (direct, lyo)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (35)

Showing the top 5 NuGet packages that depend on Lyo.Result:

Package Downloads
Lyo.Compression

A production-ready .NET compression library providing efficient, thread-safe compression for the built-in BCL algorithms (GZip, Deflate, and on net10+ Brotli, ZLib). Additional algorithms (LZ4, LZMA, Snappier, Zstd, BZip2, XZ) ship as separate Lyo.Compression.* addon packages so consumers only pay for what they use.

Lyo.Encryption

A production-ready .NET encryption library providing secure, authenticated encryption with support for multiple algorithms (AES-GCM, ChaCha20Poly1305, RSA), key management, and envelope encryption patterns.

Lyo.Validation

Reusable validators and a fluent builder for validating strongly typed models with structured Result-based failures.

Lyo.Web.Components

Blazor components library for the Lyo web UI framework with MudBlazor integration.

Lyo.MessageQueue

Message queue service interface and base implementation for asynchronous messaging.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 1,596 9/9/2026
1.0.13 2,552 8/25/2026
1.0.11 2,806 8/23/2026
1.0.9 3,035 8/22/2026
1.0.6 3,451 8/20/2026
1.0.4 3,255 8/20/2026
1.0.3 2,825 8/19/2026
1.0.2 2,774 8/19/2026
1.0.1 2,708 8/18/2026
1.0.0 2,137 8/16/2026