// validates if the parameter matches to regex pattern then sets the properties public void SetLastName(string lname) { if (RegexMatch.NameMatchesRegex(lname)) { LastName = lname; } else { throw new ArgumentException("Last Name does not match required format."); } }
// validates if the parameter matches to regex pattern then sets the properties public void SetEmail(string email) { if (RegexMatch.EmailMatchesRegex(email)) { Email = email; } else { throw new ArgumentException("Email does not match required format."); } }
// validates if the parameter matches to regex pattern then sets the properties public void SetFirstName(string fname) { if (RegexMatch.NameMatchesRegex(fname)) { FirstName = fname; } else { throw new ArgumentException("First Name does not match required format."); } }