Luis Soares
← Back to articles
ArchitectureMay 12, 2026·7 min

The Result pattern: errors without exceptions in C#

Making the error flow explicit and testable, without abusing try/catch.

LS
Luis Soares
Software architect — .NET · Azure · AI
[ Architecture ]

Exceptions for business flow hide error paths and make tests verbose. The Result pattern makes failures explicit in the return type.

Minimal shape

csharp
public readonly record struct Result<T>
{
    public T? Value { get; }
    public Error? Error { get; }
    public bool IsSuccess => Error is null;
}

Where to use it

Input validation, domain rules, external calls with expected failure — all fit Result. Save exceptions for bugs and truly exceptional failures (OOM, unexpected network down).

Turning try/catch into if (result.IsFailure) looks like more code, but the compiler starts reminding you to handle the error. In APIs, map Error to HTTP status centrally.

LS

Written by Luis Soares — software architect, on the road to Microsoft MVP.