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

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

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