Skip to content

Instantly share code, notes, and snippets.

@kouphax
Created October 16, 2010 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kouphax/630235 to your computer and use it in GitHub Desktop.
Save kouphax/630235 to your computer and use it in GitHub Desktop.
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