Created
October 16, 2010 20:35
-
-
Save kouphax/630235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person : IValidatableObject | |
{ | |
public string Name { get; set; } | |
public string Nickname { get; set; } | |
public string Password { get; set; } | |
public string PasswordConfirm { get; set; } | |
public int Age { get; set; } | |
public IEnumerable<ValidationResult> Validate( | |
ValidationContext validationContext) | |
{ | |
if (Name.Equals(Nickname)) | |
{ | |
yield return new ValidationResult( | |
"Name and Nickname cannot be the same", | |
new string[] { "Name", "Nickname" }); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment