SLR.Results 1.20250416.202237

There is a newer version of this package available.
See the version list below for details.
dotnet add package SLR.Results --version 1.20250416.202237
                    
NuGet\Install-Package SLR.Results -Version 1.20250416.202237
                    
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="SLR.Results" Version="1.20250416.202237" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SLR.Results" Version="1.20250416.202237" />
                    
Directory.Packages.props
<PackageReference Include="SLR.Results" />
                    
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 SLR.Results --version 1.20250416.202237
                    
#r "nuget: SLR.Results, 1.20250416.202237"
                    
#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 SLR.Results@1.20250416.202237
                    
#: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=SLR.Results&version=1.20250416.202237
                    
Install as a Cake Addin
#tool nuget:?package=SLR.Results&version=1.20250416.202237
                    
Install as a Cake Tool

Results

Nuget downloads Nuget Build License: MIT

SLR.Results is a .NET library that is designed to tackle a common issue. It presents an object that reflects the success or failure of an operation, as opposed to utilizing or raising exceptions.

You can install SLR.Results with NuGet:

Install-Package SLR.Results

Key Features

  • Works in most .NET Projects
  • Choose from Result, Result<T>, ListResult<T> to cater for all use cases
  • Store multiple errors or validation errors in one Result object
  • Store Error or Success objects instead of only error messages in string format
  • Allows uniformity in your code or anyone that needs to consume it
  • ApiResponseHelper to have uniform API Responses in Controllers
  • Result<List<T>> has built-in capability for paging using PagingExtensions

Return a Result

A Result can store multiple Errors, NotFound or ValidationErrors.

// return a result which indicates success
return Result.Success();

// return a result of a type which indicates success
return Result<Sample>.Success(new Sample());

//return a list result which indicates success
var entities = this.DatabaseContext.Samples.Select(x => x).AsNoTracking()
var count = await entities.Count();
var paged = await entities.ApplyPaging(model.PagingArgs).ToListAsync(cancellationToken);

return Result<List<Sample>>.Success(paged, count);

// return a result which indicates failure
return Result.Failure("Error");
return Result<List<Sample>>.Failure("Error");

Result on the API

This will handle 400, 404, 500 and 200

  return ApiResponseHelper.ResponseOutcome(await this.Mediator.Send(new ExampleQuery(), cancellationToken), this)

.NET Targeting

Latest .NET

Contributors

Thanks to all the contributors and to all the people who gave feedback!

<a href="https://github.com/stianleroux/results/graphs/contributors"> <img src="https://contrib.rocks/image?repo=stianleroux/results" /> </a>

Copyright (c) Stian Le Roux. See LICENSE for details.

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 is compatible.  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 is compatible.  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 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 192 6/7/2025
2.0.0-ci073026 96 6/7/2025
2.0.0-ci072139 87 6/7/2025
1.20250430.64549 193 4/30/2025
1.20250430.45044 172 4/30/2025
1.20250430.44808 180 4/30/2025
1.20250429.213602 164 4/29/2025
1.20250429.212713 161 4/29/2025
1.20250416.213003 216 4/16/2025
1.20250416.212638 210 4/16/2025
1.20250416.212106 224 4/16/2025
1.20250416.211701 228 4/16/2025
1.20250416.211413 230 4/16/2025
1.20250416.211031 224 4/16/2025
1.20250416.205542 222 4/16/2025
1.20250416.204854 213 4/16/2025
1.20250416.204510 226 4/16/2025
1.20250416.203406 222 4/16/2025
1.20250416.203201 227 4/16/2025
1.20250416.202237 223 4/16/2025
1.20250416.201819 230 4/16/2025
1.20250416.201607 225 4/16/2025
1.20250416.200655 224 4/16/2025
1.20250416.200456 226 4/16/2025
1.20250416.195526 227 4/16/2025
1.20250416.195236 224 4/16/2025
1.20250416.194929 226 4/16/2025
1.20250416.194630 223 4/16/2025
1.20250416.194443 223 4/16/2025
1.20250416.193447 231 4/16/2025
1.20250401.212636 198 4/1/2025
1.20250401.212431 194 4/1/2025
1.20250401.212042 200 4/1/2025
1.20250401.210635 197 4/1/2025
1.20250401.205958 194 4/1/2025
1.20250401.205654 185 4/1/2025
1.20250401.203237 201 4/1/2025
1.20250401.202933 190 4/1/2025
1.20250401.202441 198 4/1/2025
1.20250401.202207 198 4/1/2025
1.20250401.201916 198 4/1/2025
1.20250401.200941 197 4/1/2025
1.20250401.200620 203 4/1/2025
1.20250401.200144 193 4/1/2025
1.20250401.194313 202 4/1/2025
1.20250401.194144 189 4/1/2025
1.20250201.91742 156 2/1/2025
1.20250201.91539 143 2/1/2025
1.20250201.83903 140 2/1/2025
1.20230910.104229 229 9/10/2023
1.20230910.103855 131 9/10/2023
1.20230910.103129 133 9/10/2023
1.20230910.100644 140 9/10/2023
1.21.3-ci071716 82 6/7/2025
1.5.3-ci071153 90 6/7/2025
1.5.3-ci070817 95 6/7/2025