Class representing the value object Postcode.
Exemple #1
0
 public static bool TryParse(string s, IFormatProvider provider, out Postcode result)
 {
     return TryParse(s, out result);
 }
Exemple #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;
        }