コード例 #1
0
        /// <summary>
        /// Routine to generate a random email address.
        /// </summary>
        /// <param name="topLevelDomain">Top level domain to use for this address (e.g. com, net, org, edu).</param>
        /// <returns>String containing random email address.</returns>
        /// <remarks>All email addresses are for the example domain.</remarks>
        public string GetEmailAddress(string topLevelDomain)
        {
            RandomString  rs           = new RandomString();
            RandomNumber  rn           = new RandomNumber();
            StringBuilder sb           = new StringBuilder();
            string        emailAddress = string.Empty;


            sb.Append(rs.GetRandomSyllablesLC(rn.GenerateRandomInt(2, 4)));
            sb.Append(@"@example.");
            sb.Append(topLevelDomain.TrimStart('.'));

            emailAddress = sb.ToString();

            return(emailAddress);
        }