static void Main(string[] args) { var stringOpt = Maybe <string> .Some("Hello, World"); Console.WriteLine($"The length of the given string is {stringOpt.Match(() => 0, _ => _.Length)}"); Console.WriteLine($"The length of the given string is {stringOpt.Map(_ => _.Length).Fold(0, (_, x) => x)}"); var lenOpt = from s in Maybe <string> .Some("Hello, World") select s.Length; Console.WriteLine($"The length of the given string is {lenOpt.GetOrElse(0)}"); var lenOpt2 = from s1 in Maybe <string> .None select s1.Length; Console.WriteLine($"The length of the given string is {lenOpt2.GetOrElse(0)}"); var userName1 = SingleValue <string> .Some("john"); var userName2 = SingleValue <string> .Some("john"); Console.WriteLine($"The two usernames are equal : {userName1 == userName2}"); ((Maybe <string>)userName1).Match(() => null, _ => { Console.WriteLine("Call me Maybe!"); return(string.Empty); }); }