Class representing the value object Postcode.
예제 #1
0
파일: Postcode.cs 프로젝트: NLADP/ADF
 public static bool TryParse(string s, IFormatProvider provider, out Postcode result)
 {
     return TryParse(s, out result);
 }
예제 #2
0
파일: Postcode.cs 프로젝트: NLADP/ADF
        /// <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;
        }