diff --git a/Base/Structures/MaybeExtensions.cs b/Base/Structures/MaybeExtensions.cs index bbf8452..200db43 100644 --- a/Base/Structures/MaybeExtensions.cs +++ b/Base/Structures/MaybeExtensions.cs @@ -22,6 +22,9 @@ public static class MaybeExtensions return Maybe.Empty(); } + public static Maybe TryGet(this IDictionary dict, TKey key) => + dict.TryGetValue(key, out var value) ? Maybe.Just(value) : Maybe.Empty(); + public static Maybe TryGet(this IReadOnlyDictionary dict, TKey key) => dict.TryGetValue(key, out var value) ? Maybe.Just(value) : Maybe.Empty();