Beispiel #1
0
 public static bool TryParse(string representation, out decimal value)
 {
     if (FORBIDDEN_DECIMAL_PREFIXES.Any(prefix => representation.StartsWith(prefix)) || representation.EndsWith("."))
     {
         value = default;
         return(false);
     }
     else
     {
         (var succ, var val) = Any.DoConvert(() => decimal.Parse(representation, NumberStyles.AllowDecimalPoint |
                                                                 NumberStyles.AllowExponent |
                                                                 NumberStyles.AllowLeadingSign,
                                                                 CultureInfo.InvariantCulture));
         value = val;
         return(succ);
     }
 }
Beispiel #2
0
 public static bool TryParse(string representation, out long value)
 {
     (var succ, var val) = Any.DoConvert(() => XmlConvert.ToInt64(representation));
     value = val;
     return(succ);
 }