コード例 #1
0
ファイル: Decimal.cs プロジェクト: whyfate/fhir-net-common
 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);
     }
 }
コード例 #2
0
 public static bool TryParse(string representation, out long value)
 {
     (var succ, var val) = Any.DoConvert(() => XmlConvert.ToInt64(representation));
     value = val;
     return(succ);
 }