MB.Result 1.0.0

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

MB.Result NuGet Package

Overview

The MB.Result package is a flexible and robust solution for encapsulating the results of operations in .NET applications. It provides a consistent way to handle both success and failure states, along with relevant data, error messages, and HTTP status codes. This package is perfect for enhancing error handling, improving response consistency, and streamlining API responses.

Features

  • Generic Result Type: Strongly typed to accommodate any data type for success scenarios.
  • Error Handling: Supports multiple error messages, ideal for situations requiring detailed feedback.
  • HTTP Status Code Integration: Ensures that operation results are aligned with HTTP status codes, making it suitable for API development.
  • Implicit Conversions: Simplifies result creation from data or error parameters using implicit conversion operators.
  • Flexible Constructors: Multiple constructors to handle different result types (success with data or failure with error messages).

Getting Started

Installation

To integrate MB.Result into your project, install it via the NuGet package manager:

Install-Package MB.Result

Or through the .NET CLI:

dotnet add package MB.Result

Usage

  • For a successful operation, instantiate a Result object with the desired data:
var successResult = new Result<string>("Operation successful.");
  • Alternatively, leverage implicit conversion from data:
Result<string> result = "Operation successful.";
  • For error, create a Result object with an HTTP status code and error messages:
var errorResult = new Result<string>(400, new List<string> { "Error 1", "Error 2" });

License

MS.Result is licensed under the MIT License. See the LICENSE file in the source repository for full details.

Product Compatible and additional computed target framework versions.
.NET 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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
9.0.0 125 3/30/2025
1.0.0 149 3/22/2025

Result nuget package