IResultPattern 1.8.5

dotnet add package IResultPattern --version 1.8.5
                    
NuGet\Install-Package IResultPattern -Version 1.8.5
                    
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="IResultPattern" Version="1.8.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IResultPattern" Version="1.8.5" />
                    
Directory.Packages.props
<PackageReference Include="IResultPattern" />
                    
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 IResultPattern --version 1.8.5
                    
#r "nuget: IResultPattern, 1.8.5"
                    
#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 IResultPattern@1.8.5
                    
#: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=IResultPattern&version=1.8.5
                    
Install as a Cake Addin
#tool nuget:?package=IResultPattern&version=1.8.5
                    
Install as a Cake Tool

๐Ÿš€ IResultPattern

A lightweight and expressive result-handling package for .NET applications.

โœจ Clean. Explicit. Production-ready.

Stop returning raw exceptions for expected outcomes.
Stop mixing business logic with HTTP responses.
Start modeling results explicitly.

NuGet NuGet Downloads GitHub Stars License

๐Ÿ“ฆ NuGet: https://www.nuget.org/packages/IResultPattern/


๐ŸŽฏ What is this package?

IResultPattern is a dependency-free result modeling library for .NET. It gives you a consistent, strongly-typed way to represent operation outcomes across application layers.

Instead of throwing exceptions for flow control or returning loosely structured responses, you return explicit, predictable results.

โœ… Perfect for

  • ASP.NET Core Web APIs
  • Clean Architecture
  • Domain-Driven Design (DDD)
  • Microservices
  • Event-driven systems
  • Modular monoliths

๐Ÿ“ฆ Install

dotnet add package IResultPattern
using IMustafaZeynali.IResultPattern;

โœจ Key features

๐Ÿ”น Explicit status modeling

Statuses are aligned with HTTP semantics:

Status Code
Success 200
Created 201
NoContent 204
BadRequest 400
Unauthorized 401
Forbidden 403
NotFound 404
Conflict 409
ValidationError 422
InternalServerError 500
ServiceUnavailable 503

๐Ÿ”น Strongly-typed results

Result              // no payload
Result<TData>       // single item
ResultList<TData>   // collection + pagination

TData must be a reference type (class).

๐Ÿ”น Built-in pagination

ResultList<T> implements IPageInfo with:

  • TotalItemCount
  • PageCount
  • PageNumber
  • PageSize

๐Ÿ”น Clean Architecture friendly

  • Separates business outcomes from transport concerns
  • Improves readability and testability
  • Reduces exception misuse
  • Provides a consistent response contract

๐Ÿ”น Lightweight & dependency-free

  • No external dependencies
  • Targets netstandard2.1
  • Explicit factory methods โ€” no hidden magic

๐Ÿ”น Backward compatible

The legacy Failure(string) overloads remain available and are marked [Obsolete]. Prefer specific status methods instead.


๐Ÿง  Why use this instead of exceptions?

Exceptions should represent exceptional conditions โ€” not validation failures or other predictable outcomes.

This package encourages:

  • Explicit business outcomes
  • Better error handling
  • Consistent API behavior
  • Easier testing
  • Clearer code semantics

๐Ÿ”ฅ Examples

๐Ÿ“„ Without data

return Result.Success();

return Result.NotFound("User not found");

return Result.ValidationError("Email is required");

๐Ÿ“Œ Single item

return Result<User>.Success(user);

return Result<User>.NotFound("User not found");

return Result<User>.ValidationError("Email is required");

๐Ÿ“š List with pagination

return ResultList<User>.Success(users, totalItemCount: 120);

return ResultList<User>.Success(users, pageInfo);

return ResultList<User>.NotFound("No users found");

return ResultList<User>.ValidationError("Invalid page size");

โšก Implicit conversions

Result result = ResultStatus.NotFound;   // failure statuses
Result<User> ok = user;                  // wraps as Success

๐Ÿ‘ฅ Who is this for?

Developers who:

  • Care about clean, explicit code
  • Use DDD or Clean Architecture
  • Want expressive application flow
  • Build scalable APIs and services

๐Ÿ“„ License

Licensed under the Apache License 2.0.


๐Ÿž Contributing

Found a bug or have an idea?
Open an issue: https://github.com/IMustafaZeynali/IResultPattern/issues

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 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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.
  • .NETStandard 2.1

    • 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
1.8.5 116 8/25/2026
1.8.2 87 8/25/2026
1.8.1 84 8/21/2026
1.8.0 115 8/9/2026
1.7.2 106 7/20/2026
1.7.0 119 4/18/2026
1.5.1 137 2/19/2026
1.5.0 125 2/19/2026
1.4.1 126 2/4/2026
1.4.0 133 2/4/2026