Functional Programming, Csharp, Programming.
your needs. Consider having a static factory method with clear names for readability; type conversion operators for purity etc. static class Math { public static Result<int> Divide(int a, int b) { if (b == 0) return Result.Error(ErorrCode.CannotDivideByZero); return Result.Success(a / b); } }