SharpPyxis.Results
1.0.0
dotnet add package SharpPyxis.Results --version 1.0.0
NuGet\Install-Package SharpPyxis.Results -Version 1.0.0
<PackageReference Include="SharpPyxis.Results" Version="1.0.0" />
<PackageVersion Include="SharpPyxis.Results" Version="1.0.0" />
<PackageReference Include="SharpPyxis.Results" />
paket add SharpPyxis.Results --version 1.0.0
#r "nuget: SharpPyxis.Results, 1.0.0"
#:package SharpPyxis.Results@1.0.0
#addin nuget:?package=SharpPyxis.Results&version=1.0.0
#tool nuget:?package=SharpPyxis.Results&version=1.0.0
SharpPyxis
A collection of small, focused .NET primitives with zero external dependencies.
Each package is independent — take only what you need.
| Package | Description | NuGet |
|---|---|---|
SharpPyxis.Results |
Result<T> and Error primitives for explicit error handling |
(coming soon) |
SharpPyxis.Guards |
Argument validation guards and UserFacingException |
(coming soon) |
Target frameworks: net8.0, net10.0
SharpPyxis.Results
Represent operation outcomes without throwing exceptions. Model success and failure explicitly.
Installation
dotnet add package SharpPyxis.Results
Usage
using SharpPyxis.Results;
// Return a result from a service
public Result<User> FindUser(Guid id)
{
var user = _db.Find(id);
return user is null
? Result.Failure<User>(Error.NotFound("User.NotFound", $"User {id} was not found."))
: Result.Success(user);
}
// Consume it
var result = FindUser(id);
if (result.IsFailure)
return result.Error; // Error.Code, Error.Message, Error.Type
var user = result.Value;
Error factory methods
Error.NotFound("User.NotFound", "User was not found.")
Error.Conflict("Email.Conflict", "Email is already in use.")
Error.Validation("Name.Required", "Name is required.")
Error.Unauthorized("Auth.Expired", "Token has expired.")
Error.Forbidden("Role.Missing", "Insufficient permissions.")
Error.Unexpected("Order.Failed", "An unexpected error occurred.")
SharpPyxis.Guards
Argument validation guards that throw developer-facing exceptions on invalid input.
Parameter names are captured automatically — no nameof() required at call sites.
Installation
dotnet add package SharpPyxis.Guards
Usage
using SharpPyxis.Guards;
public UserService(IUserRepository repository)
{
_repository = Guard.NotNull(repository);
}
public Task<User> CreateAsync(string name, string email, Guid tenantId)
{
Guard.NotWhiteSpace(name);
Guard.NotEmpty(email);
Guard.NotEmpty(tenantId);
Guard.Satisfies(name, n => n.Length <= 100, "Name must be 100 characters or fewer.");
// ...
}
UserFacingException
For cases where returning a Result<T> is impractical and the error message is safe to surface to the end user:
throw new UserFacingException("Invoice amount must be greater than zero.");
// With a custom HTTP status code:
throw new UserFacingException("Resource has been locked.", statusCode: 423);
Contributing
Contributions welcome. Each package must remain independently usable with zero external dependencies (only the .NET SDK).
License
MIT
| 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. net9.0 was computed. 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
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.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 142 | 4/28/2026 |