Exemplo n.º 1
0
 public static T?AsNullable <T>(this May <T> potentialValue) where T : struct
 {
     return(potentialValue.Select(e => (T?)e).ElseDefault());
 }
Exemplo n.º 2
0
 public static May <T> Else <T>(this May <T> potentialValue, May <T> alternative)
 {
     return(potentialValue.Else(() => alternative));
 }
Exemplo n.º 3
0
 public static T ForceGetValue <T>(this May <T> potentialValue)
 {
     return(potentialValue.Match(
                e => e,
                () => { throw new InvalidOperationException("No Value"); }));
 }
Exemplo n.º 4
0
 public static May <T> Unwrap <T>(this May <May <T> > potentialValue)
 {
     return(potentialValue.Bind(e => e));
 }
Exemplo n.º 5
0
 public static T ElseDefault <T>(this May <T> potentialValue)
 {
     return(potentialValue.Else(default(T)));
 }