Beispiel #1
0
        public void CastInt_null()
        {
            object             o = null;
            FSharpOption <int> a = Option.Cast <int>(o);

            Assert.IsFalse(a.HasValue());
        }
Beispiel #2
0
 public static T ValueOrDefault <T>(this FSharpOption <T> value, T defaultValue)
 {
     if (!value.HasValue())
     {
         return(defaultValue);
     }
     return(value.Value);
 }
 public static T GetValueOrDefault <T>(this FSharpOption <T> option, T @default = default) => option.HasValue() ? option.Value : @default;
 public static T?AsNullable <T>(this FSharpOption <T> option) where T : struct => option.HasValue() ? option.Value : default;