PerfectResult 1.0.2
dotnet add package PerfectResult --version 1.0.2
NuGet\Install-Package PerfectResult -Version 1.0.2
<PackageReference Include="PerfectResult" Version="1.0.2" />
paket add PerfectResult --version 1.0.2
#r "nuget: PerfectResult, 1.0.2"
// Install PerfectResult as a Cake Addin
#addin nuget:?package=PerfectResult&version=1.0.2
// Install PerfectResult as a Cake Tool
#tool nuget:?package=PerfectResult&version=1.0.2
PerfectResult .NET 8 Result Handling Library
A library for elegantly handling operation results, including success and failure scenarios, with support for both generic and non-generic types. Designed for ease of use and integration into .NET projects.
Description
This library offers a standardized way to represent the outcomes of operations, whether successful or failed. It includes both generic and non-generic implementations, allowing for flexibility and robust error handling in your .NET applications.
Getting Started
Dependencies
.NET 8
An IDE like Visual Studio or VS Code for .NET development
Installing via NuGet
To install the library, use the following NuGet command:
Install-Package PerfectResult
Or via the .NET CLI:
dotnet add package PerfectResult
Usage
Creating a Success Result
var success = IResult.SuccessResult("Operation successful");
// For generic type
var successGeneric = IResult.SuccessResult(100, "Operation successful");
Creating a Failure Result
var failure = IResult.FailureResult("Operation failed", new Exception("Error detail"));
// For generic type
var failureGeneric = IResult.FailureResult<int>("Operation failed", new Exception("Error detail"));
But the most important is to use as a object from method:
public IResult<MyObject> GetMyObject()
{
if (* something is wrong *)
{
return IResult.FailureResult("Operation failed", new Exception("MyObject Failed"));
}
MyObject objectToReturn = new();
return IResult.SuccessResult(objectToReturn);
}
Contributing
Contributions to enhance this library are welcome. Please adhere to the following steps:
Fork the repository.
Create a new branch for your feature (git checkout -b feature/AmazingFeature).
Commit your changes (git commit -m 'Add some AmazingFeature').
Push to the branch (git push origin feature/AmazingFeature).
Open a pull request.
Version History
1.0.0
Initial Release.
1.0.1
Initial Release - fixing the nugget's lib folder.
1.0.2
Initial Release - fixing the flags and debugging data.
Authors
Josef Širůčka
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Product | Versions 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. |
-
net8.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.
Initial Release.