Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Getting Started with EricksonLopez.ValueObjects

dotnet add package EricksonLopez.ValueObjects --version 2.0.0
using EricksonLopez.Result;
using EricksonLopez.ValueObjects;
namespace Example.ValueObjects;
public static class BillingCalculator
{
public static Result<Money[]> SplitInvoice(decimal grossAmount, string currencyIso)
{
var currencyResult = CurrencyCode.Create(currencyIso);
if (currencyResult.IsFailure)
{
return currencyResult.Error;
}
var moneyResult = Money.Create(grossAmount, currencyResult.Value);
if (moneyResult.IsFailure)
{
return moneyResult.Error;
}
// Lossless distribution across 70% / 30% shares without cent drift
return moneyResult.Value.Allocate(new[] { 70, 30 });
}
}