public static Maybe <V> SelectMany <T, U, V>(this Maybe <T> maybe, Func <T, Maybe <U> > selector, Func <T, U, V> project) { return(maybe.Unwrap( x => selector(x).Unwrap(u => project(x, u), Maybe <V> .None), Maybe <V> .None)); }
public static List <T> ToList <T>(this Maybe <T> maybe) { return(maybe.Unwrap(value => new List <T> { value }, new List <T>())); }
public static T Unwrap <T>(this Maybe <T> maybe, T defaultValue = default(T)) { return(maybe.Unwrap(x => x, defaultValue)); }
public static T Unwrap <T>(this Maybe <T> maybe, T defaultValue = null) where T : class { return(maybe.Unwrap(x => x, defaultValue)); }