1 using System.Collections.Generic;
3 using JetBrains.Annotations;
5 namespace FxSharp.Extensions
10 public static class DictionaryExtensions
24 public static Maybe<TValue> GetMaybe<TKey, TValue>(
25 [NotNull]
this IDictionary<TKey, TValue> dict,
28 Ensure.NotNull(dict,
"dict");
29 Ensure.NotNull(key,
"key");
31 return dict.ContainsKey(key) ? Maybe.Just(dict[key]) : Maybe.Nothing<TValue>();