Anillen.ResultObjects 9.0.5

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

Result Object для .NET

NuGet Version CI/CD

Простая и удобная реализация паттерна Result Object для .NET, позволяющая обрабатывать ошибки без использования исключений.

📦 Установка

dotnet add package Anillen.ResultObjects

🎯 Зачем использовать Result Object?

Традиционный подход с исключениями:

  • Нарушает поток выполнения
  • Дорогостоящий по производительности
  • Неявно описывает возможные ошибки

Result Object решает эти проблемы, предоставляя:

  • Явное описание успешных/неуспешных операций
  • Функциональный подход к обработке ошибок
  • Легковесную альтернативу исключениям

📚 Примеры использования

Базовый сценарий

public ResultValue<Customer> GetCustomer(int id)
{
    if (id <= 0)
        return ResultValue.Failure<Customer>(new Error("400", "Id is not valid"));

    var customer = _repository.Find(id);
    return customer is not null 
        ? ResultValue.Success(customer) 
        : ResultValue.Failure<Customer>(new Error("404", "Not found"));
}

Только результат операции

public Result SendMessage(string message)
{
    if (string.IsNullOrEmpty(message))
        return Result.Failure(new Error("400", "Message is not valid"));
    try
    {
        _messageService.SendMessage(message);
        return Result.Success();
    } catch(Exception ex)
    {
        return Result.Failure(new Error("SendMessageError", ex.Message));
    }
}

⭐ Если проект вам понравился, поставьте звезду на GitHub!

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.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.5 289 4/14/2025
9.0.4 484 4/10/2025
9.0.3 239 4/10/2025
9.0.2 242 4/10/2025