예제 #1
0
파일: PhoneNumber.cs 프로젝트: NLADP/ADF
 public static bool TryParse(string s, IFormatProvider provider, out PhoneNumber result)
 {
     return TryParse(s, out result);
 }
예제 #2
0
파일: PhoneNumber.cs 프로젝트: NLADP/ADF
        /// <summary>
        /// Tries to parse the supplied string into the supplied <see cref="PhoneNumber"/> object.
        /// </summary>
        /// <param name="s">The string to parse.</param>
        /// <param name="result">The <see cref="PhoneNumber"/> object.</param>
        /// <returns>True if the parsing is successful, false otherwise.</returns>
        public static bool TryParse(string s, out PhoneNumber result)
        {
            if (string.IsNullOrEmpty(s))
            {
                result = Empty;
                return true;
            }

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

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