Created
February 26, 2016 13:31
-
-
Save testfirstcoder/ce3f3c79b15ce3c28e66 to your computer and use it in GitHub Desktop.
Get pattern from DataAnnotations.RegularExpressionAttribute
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
string GetRegularExpressionAttributePattern<T>(string property) | |
{ | |
return typeof(T) | |
.GetProperty(property) | |
.GetCustomAttribute<RegularExpressionAttribute>() | |
.Pattern; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment