Odin.System.Result
0.9.37
dotnet add package Odin.System.Result --version 0.9.37
NuGet\Install-Package Odin.System.Result -Version 0.9.37
<PackageReference Include="Odin.System.Result" Version="0.9.37" />
<PackageVersion Include="Odin.System.Result" Version="0.9.37" />
<PackageReference Include="Odin.System.Result" />
paket add Odin.System.Result --version 0.9.37
#r "nuget: Odin.System.Result, 0.9.37"
#:package Odin.System.Result@0.9.37
#addin nuget:?package=Odin.System.Result&version=0.9.37
#tool nuget:?package=Odin.System.Result&version=0.9.37
About Odin.System.Result
Odin.System.Result, part of the OrDinary INfrastructure libraries, provides several 'Result' classes, which all encapsulate the outcome of an operation, together with a list of messages.
Result is the simplest concept.
ResultValue of TValue adds a generic Value property.
Result of TMessage and ResultValue of TValue, TMessage add support for the Messages list to be of any type.
ResultEx and ResultValueEx of TValue come with a TMessage type that is aligned with logging failure issues.
Getting Started
1 - Result: Success() and Failure()
public class HeartOfGoldService
{
public Result WarpSpeedToMilliways()
{
if (_eddie.IsOK()) return Result.Success();
return Result.Failure(["Zaphod, that is not possible...", "Error 42"])
}
}
2 - Result: IsSuccess and Messages properties
Result outcome = _heartOfGold.WarpSpeedToMilliways()
if (!outcome.IsSuccess)
{
outcome.Messages.ForEach(m => _logger.LogWarning(m));
}
3 - ResultValue:
Adds a generic Value property to Result.
public class ZaphodMemoryFetcherService
{
public ResultValue<IReadonlyList<MemSnippet>>
FetchMemoriesFor(Source source, DateOnly day)
{
var results = new List<MemSnippet>();
...
...
// On success...
return ResultValue<IReadonlyList<MemSnippet>>.Success(results);
// On failure...
return ResultValue<IReadonlyList<MemSnippet>>.Failure("Tampering detected!")
}
}
4 - ResultValue: IsSuccess, Value and Messages properties
ResultValue<IReadonlyList<MemSnippet>> outcome =
_zaphod.FetchMemoriesFor(_milliwaysDinner, DateOnly.MaxValue)
if (outcome.IsSuccess)
{
var memories = outcome.Value;
}
else
{
outcome.Messages.ForEach(m => _logger.LogWarning(m));
}
5 - Result & ResultValue Messages can also be of type TMessage, as opposed to just string.
public record MyMessage(int EventId, string Message)
Result<MyMessage> result = Result<MyMessage>.Failure(
new MyMessage(134, "Some message"));
...
result.Messages.ForEach(m => _logger.LogWarning(m.EventId, m.Message));
6 - ResultEx & ResultValueEx
Uses a message type that is aligned with logging...
ResultEx result = ResultEx.Failure(LogLevel.Critical,
"Zaphod has broken the improbability drive", unhandledWarpExceptionCaught);
...
MessageEx message = result.Messages[0];
_logger.Log(message.Severity, message.Error, message.Message);
| 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 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 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
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.11)
NuGet packages (11)
Showing the top 5 NuGet packages that depend on Odin.System.Result:
| Package | Downloads |
|---|---|
|
Odin.Common
Common elements used in the OrdinaryInfrastructure libraries, including logging, design contract elements, and various other elements. Odin = OrDinary INfrastructure. |
|
|
Odin.Email
Provides a simple EmailMessage object model and IEmailSender interface for out of the box sending of email through any email sending service. Mailgun, Office365 (via MS Graph) and SMTP currently supported. |
|
|
Odin.BackgroundProcessing
A now redundant abstraction of Hangfire's job processing functionality for the original purpose of mocking Hangfire. Abstracts background processing related use cases via an IBackgroundProcessor interface, required in the days that Hangfire still has static entry points to its functionality. |
|
|
Odin.Cryptography
Originally intended as a wrapper for ordinary use cases around .NET DataProtection APIs. Provides a simple ICryptographer concept supporting Encrypt and Decrypt. |
|
|
Odin.BackgroundProcessing.Abstractions
A now redundant abstraction of Hangfire's job processing functionality for the original purpose of mocking Hangfire. Abstracts background processing related use cases via an IBackgroundProcessor interface, required in the days that Hangfire still has static entry points to its functionality. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.9.37 | 296 | 1/6/2026 |
| 0.9.37-traderbilling-up0011 | 282 | 1/6/2026 |
| 0.9.37-traderbilling-up0004 | 295 | 1/5/2026 |
| 0.9.36-designcontractsv0019 | 387 | 12/22/2025 |
| 0.9.32 | 395 | 12/21/2025 |
| 0.9.25 | 377 | 12/21/2025 |
| 0.9.21 | 385 | 12/21/2025 |
| 0.9.11 | 474 | 12/19/2025 |
| 0.9.10 | 449 | 12/19/2025 |
| 0.9.9 | 490 | 12/18/2025 |
| 0.9.8 | 474 | 12/15/2025 |
| 0.9.7 | 479 | 12/15/2025 |
| 0.9.6 | 467 | 12/15/2025 |
| 0.9.5 | 457 | 12/15/2025 |
| 0.9.4 | 464 | 12/15/2025 |
| 0.9.3 | 620 | 12/11/2025 |
| 0.9.2 | 626 | 12/11/2025 |
| 0.9.1 | 661 | 12/9/2025 |
| 0.9.0 | 572 | 12/8/2025 |
| 0.4.16 | 430 | 12/7/2025 |
| 0.4.14 | 350 | 12/6/2025 |
| 0.4.13 | 451 | 12/6/2025 |
| 0.4.12 | 355 | 12/6/2025 |
| 0.4.11 | 393 | 12/5/2025 |
| 0.4.7 | 418 | 12/5/2025 |
| 0.4.6 | 448 | 12/5/2025 |