DotaNet.Results 18.16.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DotaNet.Results --version 18.16.1                
NuGet\Install-Package DotaNet.Results -Version 18.16.1                
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="DotaNet.Results" Version="18.16.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotaNet.Results --version 18.16.1                
#r "nuget: DotaNet.Results, 18.16.1"                
#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.
// Install DotaNet.Results as a Cake Addin
#addin nuget:?package=DotaNet.Results&version=18.16.1

// Install DotaNet.Results as a Cake Tool
#tool nuget:?package=DotaNet.Results&version=18.16.1                

DotaNet.Results

Result

public record Result(HttpStatusCode Status)
{
    public Result(HttpStatusCode status, string message) : this(status) => Message = message;

    public string Message { get; init; } = string.Empty;

    public bool HasMessage => !string.IsNullOrWhiteSpace(Message);

    public Result<T> Convert<T>() => new(Status, Message);
}

Result<T>

public sealed record Result<T> : Result
{
    public Result(HttpStatusCode status) : base(status) { }

    public Result(HttpStatusCode status, T value) : base(status) { Value = value; }

    public Result(HttpStatusCode status, string message) : base(status, message) { }

    public Result(T? value) : base(value is not null ? HttpStatusCode.OK : HttpStatusCode.NotFound) { Value = value; }

    public T? Value { get; }

    public bool HasValue => Value is not null;

    public Result Convert() => new(Status, Message);
}
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DotaNet.Results:

Package Downloads
DotaNet.Mediator

DotaNet.Mediator

DotaNet.AspNetCore

DotaNet.AspNetCore

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
18.16.2 279 9/14/2024
18.16.1 82 9/8/2024
18.16.0 118 9/1/2024