Result
Success or failure, never both. Chain operations with Bind, transform values with Map, unwrap at the boundary with Match. Errors propagate automatically — no boilerplate.
Learn more
Replace exception-driven control flow with composable, explicit error handling — zero dependencies, pure .NET.
The same operation — one with exceptions, one with Railway-Oriented Programming:
// Exception-driven: contract invisible to callers
public User CreateUser(string name, string email)
{
if (string.IsNullOrWhiteSpace(name))
throw new ValidationException("Name required");
if (!email.Contains('@'))
throw new ValidationException("Invalid email");
var existing = _db.Users
.FirstOrDefault(u => u.Email == email);
if (existing != null)
throw new ConflictException("Email taken");
return _db.Save(new User(name, email));
}
// Every caller needs try/catch.
// Errors are invisible in the signature.// Railway-Oriented: contract explicit in the return type
public Result<User> CreateUser(string name, string email) =>
ValidateName(name)
.Bind(_ => ValidateEmail(email))
.Bind(_ => CheckEmailNotTaken(email))
.Map(_ => new User(name, email))
.Bind(user => _db.Users.AddAsync(user));
// The signature tells the truth.
// Errors propagate automatically — no try/catch.
// Compose at the controller with Match:
return result.Match(
onSuccess: user => Ok(user),
onFailure: error => error.Type switch {
ErrorType.Validation => BadRequest(error.Message),
ErrorType.Conflict => Conflict(error.Message),
_ => Problem(error.Message)
});MonadicSharp is a family of focused packages — use only what you need.
Enterprise AI agent infrastructure — Agents, Security, Telemetry, Http, Persistence, Caching in one meta-package.
meta-packageTyped LLM errors, retry with backoff, agent pipeline tracing, structured output validation, streaming.
nugetSelf-healing pipelines. RescueAsync and StartFixBranchAsync bring failed operations back to the green track.
nugetRailway-Oriented wrappers for CosmosDB, Service Bus, Blob, Key Vault, Azure OpenAI — every call returns Result<T>.
nugetLightweight functional mediator. CQRS aligned with Result<T> — handlers never throw, behaviors compose cleanly.
nugetRoslyn analyzers that enforce green-code rules. Green Score 0–100 per project. Auto-migration for common violations.
wipGreen-code analysis and auto-migration inside your OpenCode AI coding session. /forge-analyze, /green-check, /migrate.
toolingAI agent observability platform. Pipeline tracing, metrics dashboard, circuit breakers, alerts — native .NET.
wip