Class representing the value object Postcode.
Ejemplo n.º 1
0
 public static bool TryParse(string s, IFormatProvider provider, out Postcode result)
 {
     return TryParse(s, out result);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Tries to parse the supplied string into the supplied <see cref="Postcode"/> object.
        /// </summary>
        /// <param name="s">The string to parse.</param>
        /// <param name="result">The <see cref="Postcode"/> object.</param>
        /// <returns>True if the parsing is successful, false otherwise.</returns>
        public static bool TryParse(string s, out Postcode result)
        {
            if (string.IsNullOrEmpty(s))
            {
                result = Empty;
                return true;
            }

            if (!Expression.IsMatch(s))
            {
                result = Empty;
                return false;
            }

            result = new Postcode(s);
            return true;
        }