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