From 6e18e0195cc487ead9302e3f35b48e6a79ae9c35 Mon Sep 17 00:00:00 2001 From: Oli Sturm Date: Sun, 10 May 2026 14:35:47 +0100 Subject: [PATCH] result type ok improved --- csharp-es/Library/Result.cs | 5 ++++- csharp-fp3/Library/Result.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/csharp-es/Library/Result.cs b/csharp-es/Library/Result.cs index 123578a..5e2e93f 100644 --- a/csharp-es/Library/Result.cs +++ b/csharp-es/Library/Result.cs @@ -21,8 +21,11 @@ public static class ResultModule { public static T Ok(T v) => v; + public static Result Ok(T v) + => new ResultOk(v); + public static Result OkNone() - where T : class? => new ResultOk(null); + => new ResultOk(default); public static E Fail(E e) => e; } diff --git a/csharp-fp3/Library/Result.cs b/csharp-fp3/Library/Result.cs index d690b5f..ce941bc 100644 --- a/csharp-fp3/Library/Result.cs +++ b/csharp-fp3/Library/Result.cs @@ -21,8 +21,11 @@ public static class ResultModule { public static T Ok(T v) => v; + public static Result Ok(T v) + => new ResultOk(v); + public static Result OkNone() - where T : class? => new ResultOk(null); + => new ResultOk(default); public static E Fail(E e) => e; }