Adf.Business.ValueObject.Email.Email C# (CSharp) Method

Email() public method

Initializes a new instance of the Email class.
If the e-mail address could not be validated, a FormatException exception is thrown.
public Email ( string newvalue ) : System
newvalue string The e-mail address to use.
return System
        public Email(string newvalue)
        {
            //initialize
            value = string.Empty;

            _hashCode = 0;

            if (string.IsNullOrEmpty(newvalue)) return;

            if (!Expression.IsMatch(newvalue))
            {
                throw new FormatException("emailaddress is not in a valid format");
            }

            value = newvalue;
            _hashCode = value.ToUpperInvariant().GetHashCode();
        }