FreeMoney.FreeMoneyHelpers.IsValidEmail C# (CSharp) Method

IsValidEmail() public static method

method for determining is the user provided a valid email address We use regular expressions in this check, as it is a more thorough way of checking the address provided
http://www.dreamincode.net/code/snippet1374.htm
public static IsValidEmail ( string email ) : bool
email string email address to validate
return bool
        public static bool IsValidEmail(string email)
        {
            //regular expression pattern for valid email
            //addresses, allows for the following domains:
            //com,edu,info,gov,int,mil,net,org,biz,name,museum,coop,aero,pro,tv
            const string pattern = @"^[-_a-zA-Z0-9][-._a-zA-Z0-9]*@[-._a-zA-Z0-9]+(\.[-._a-zA-Z0-9]+)*\.(com|edu|info|gov|int|mil|net|org|biz|name|museum|coop|aero|pro|tv|[a-zA-Z]{2})$";
            //Regular expression object
            Regex check = new Regex(pattern, RegexOptions.IgnorePatternWhitespace);
            //boolean variable to return to calling method
            bool valid = false;

            //make sure an email address was provided
            if (string.IsNullOrEmpty(email))
            {
                valid = false;
            }
            else
            {
                //use IsMatch to validate the address
                valid = check.IsMatch(email);
            }
            //return the value to the calling method
            return valid;
        }
FreeMoneyHelpers