Rop.Results9 1.2.3

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

Rop.Results9

Rop.Result is a C# library that provides a way to handle errors without exceptions. Instead of throwing an exception, functions return a Result object that can be either a Success or a Failed state.

Installation

To install the library, you can use the NuGet package manager. In the Visual Studio terminal, run the following command:

Install-Package Rop.Results9

Usage

To use the library, you need to import the Rop.Result9 namespace:

using Rop.Result9;

Then you can create Result objects using implicit conversions:


public Result<int> Divide1(int dividend, int divisor)
    {
        if (divisor == 0)
        {
            return Error.Fail("Cannot divide by zero.");
        }
        else
        {
            return dividend / divisor;
        }
    }

You can also use the Result object in a fluent way:

public VoidResult ShowDivide(int divident,int divisor)
    {
        var result = Divide1(divident, divisor);
        return result.Map(
            v => Console.WriteLine($"The result is {result.Value}"),
            e => Console.WriteLine($"Error: {result.Error!.Value}")
        );
    }

public VoidResult ShowDivide2(int divident,int divisor)
    {
        var result = Divide1(divident, divisor);
        if (result.IsFailed) 
            return result;
        Console.WriteLine($"The result is {result.Value!}");
        return VoidResult.Ok;
    }
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Rop.Results9:

Package Downloads
Rop.Winforms9.Helper

Helper classes for Winforms

Rop.Winforms9.Basic

Basic Forms classes for Winforms

Rop.Winforms9.DropControls

DropControls

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.3 133 10/30/2024
1.2.2 119 10/7/2024
1.2.1 117 10/7/2024
1.2.0 104 10/7/2024