Advertisement
simonradev

Validator

Dec 9th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.26 KB | None | 0 0
  1. private static bool IsValid(object instance)
  2.         {
  3.             var validationContext = new System.ComponentModel.DataAnnotations.ValidationContext(instance);
  4.             return Validator.TryValidateObject(instance, validationContext, null, true);
  5.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement