Exemple #1
0
 public void IsNoneOnNonNullObjectIsFalse()
 {
     Assert.IsFalse(nonNullOption.IsNone());
 }
Exemple #2
0
 public void IsNoneOnNullObjectIsTrue()
 {
     Assert.IsTrue(nullOption.IsNone());
 }
 public static FSharpOption <TR> Map <T, TR>(this FSharpOption <T> option, Func <T, TR> f)
 {
     return(option.IsNone() ? FSharpOption <TR> .None : FSharpOption <TR> .Some(f(option.Value)));
 }
 public static FSharpOption <TR> Bind <T, TR>(this FSharpOption <T> option, Func <T, FSharpOption <TR> > f)
 {
     return(option.IsNone() ? FSharpOption <TR> .None : f(option.Value));
 }
 public static T ValueOrDefault <T>(this FSharpOption <T> option, T defaultValue)
 {
     return(option.IsNone() ? defaultValue : option.Value);
 }
Exemple #6
0
 public static Result <TE, TA> FromOption(FSharpOption <TA> option, TE error)
 {
     return(option.IsNone() ? Error(error) : Ok(option.Value));
 }