Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize regex validator #2035

Merged
merged 2 commits into from Jan 11, 2023
Merged

Optimize regex validator #2035

merged 2 commits into from Jan 11, 2023

Conversation

benmccallum
Copy link
Contributor

Probably no need to instantiate the regex if the value being null never means it gets executed.

Probably no need to instantiate the regex if the value being null never means it gets executed.
@benmccallum
Copy link
Contributor Author

Was just digging around with .NET 7's GeneratedRegex attribute and it's possible with the Func<T, Regex> overload to call the generated regex property which is pretty cool, but thought I'd point out a potential optimization here.

@JeremySkinner
Copy link
Member

hi @benmccallum thanks for this, although it doesn't build at the moment. Could you add in this missing semicolon then I'll get this merged. Thanks!

@benmccallum
Copy link
Contributor Author

Ha, I swear 99% of the time I edit a file for something small like this online in GitHub I miss something and it doesn't build 😆

🤞🏻 it's ok now. and no worries :)

@JeremySkinner JeremySkinner merged commit 514d853 into FluentValidation:main Jan 11, 2023
@JeremySkinner
Copy link
Member

Thanks!

@benmccallum benmccallum deleted the patch-1 branch January 12, 2023 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants