I'm trying to validate an email data type in a console app using Data Annotations, but it is returning "true" even though I know for a fact the email address isn't valid (I'm sending in "notavalidemail").
Here is my code.
Model:
class Email
    {
        [DataType(DataType.EmailAddress)]
        public string email { get; set; }
    }
Snippet from Program.cs:
     Email emailAdress = new Email();
     emailAdress.email = "notavalidemail";
     var vc = new ValidationContext(emailAdress, null, null);
     var isValid = Validator.TryValidateObject(emailAdress, vc, null);
Am I missing something, or is it even possible to validate data types this way in a console app?
 
     
     
    