AtlasSync.Results 1.0.2

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

AtlasSync.Results

AtlasSync.Results A .NET library for working with result objects, providing a standardized way to handle operation outcomes.

Installation

Add the package to your project via NuGet:

dotnet add package AtlasSync.Results

Overview

The AtlasSync.Results library provides a set of classes and methods for creating and working with result objects. These objects can be used to represent the outcome of an operation, including success or failure, and provide additional information such as error messages and HTTP status codes.

Key Features

  • ResultBase: A base class for result objects, providing common properties and methods.
  • Result<T>: A generic result class that can be used to represent the outcome of an operation, including a payload of type T.
  • Result: A non-generic result class that can be used to represent the outcome of an operation without a payload.
  • Success and Failure methods: Static methods for creating successful and failed result objects.

Example Usage

Here's an example of how to use the AtlasSync.Results library:

using AtlasSync.Results;

// Create a successful result object with a payload
var result = Result<string>.Success("Hello, World!", HttpStatusCode.OK);

// Create a failed result object with an error message and HTTP status code
var failedResult = Result<string>.Failure("Something went wrong", HttpStatusCode.InternalServerError);

// Create a failed result object with an error message, HTTP status code, and error code
var failedResultWithErrorCode = Result<string>.Failure("Something went wrong", HttpStatusCode.InternalServerError, 500);

// Check if a result object is successful
if (result.IsSuccessful)
{
    Console.WriteLine("Operation was successful");
}
else
{
    Console.WriteLine("Operation failed: " + result.ErrorMessage);
}

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

License

This package is licensed under the MIT License. See the LICENSE file for more details.

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
1.0.2 193 12/20/2024
1.0.1 162 12/20/2024
1.0.0 171 12/12/2024