AtlasSync.Results
1.0.2
dotnet add package AtlasSync.Results --version 1.0.2
NuGet\Install-Package AtlasSync.Results -Version 1.0.2
<PackageReference Include="AtlasSync.Results" Version="1.0.2" />
<PackageVersion Include="AtlasSync.Results" Version="1.0.2" />
<PackageReference Include="AtlasSync.Results" />
paket add AtlasSync.Results --version 1.0.2
#r "nuget: AtlasSync.Results, 1.0.2"
#:package AtlasSync.Results@1.0.2
#addin nuget:?package=AtlasSync.Results&version=1.0.2
#tool nuget:?package=AtlasSync.Results&version=1.0.2
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 | Versions 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. |
-
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.