A lightweight and expressive result‑handling package designed for .NET applications.
🚀 IResult Pattern – A Clean, Explicit and Production-Ready Result Model for .NET
Stop returning raw exceptions. Stop mixing business logic with HTTP responses. Start modeling results explicitly.
IResult Pattern is a lightweight, production-ready result modeling library for .NET applications that provides a clean and consistent way to represent operation outcomes.
Instead of throwing exceptions for flow control or returning loosely structured responses, this package helps you return strongly-typed, explicit, and predictable results across your application layers.
- ASP.NET Core Web APIs
- Clean Architecture
- Domain-Driven Design (DDD)
- Microservices
- Event-Driven systems
- Modular monoliths
🔹 Explicit Status Modeling
- Success (200)
- Created (201)
- NoContent (204)
- BadRequest (400)
- Unauthorized (401)
- Forbidden (403)
- NotFound (404)
- Conflict (409)
- ValidationError (422)
- InternalServerError (500)
- ServiceUnavailable (503)
This enables clear and predictable API behavior.
🔹 Strongly-Typed Results
Result<T>
ResultReturn data safely with proper status and messages.
🔹 Backward Compatible
Legacy Failure status is still supported (marked as obsolete), ensuring no breaking changes for existing systems.
🔹 Clean Architecture Friendly
- Separate business logic from transport layer concerns
- Improve readability
- Reduce exception misuse
- Provide consistent response contracts
🔹 Lightweight & Dependency-Free
- No external dependencies.
- No magic.
- Just clean, explicit result modeling.
Exceptions should represent exceptional conditions — not validation failures or predictable outcomes.
- Explicit business outcomes
- Better error handling
- Improved API consistency
- Easier testing
- Clearer code semantics
return Result.Success(data);
return Result.NotFound("User not found");
return Result.ValidationError(errors);This package is ideal for developers who:
Care about clean code
- Use DDD or Clean Architecture
- Want explicit and expressive application flow
- Build scalable APIs and services
If you believe that clarity and correctness matter in software design — this package is for you.
🐞 Found a bug?
Please open an issue on GitHub:
https://github.com/IMustafaZeynali/IResultPattern/issues