Click here to Skip to main content
15,890,973 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I'm building a WPF application, and I'm at the point where I need to validate user-entered data in a dialog.

Do the .NET libraries contain 'pre-built' ValidationRule classes for the base types? I'm thinking of simple things like length checks on strings, range checks for numeric values, and that sort of thing.

I've not been able to find anything. My experience in learning .NET so far has been that, if I can't find something simple that feels like it ought to be built-in, I'm not approaching the problem correctly.

Posted

1 solution

Gary Wheeler wrote:
Do the .NET libraries contain 'pre-built' ValidationRule classes for the base types? I'm thinking of simple things like length checks on strings, range checks for numeric values, and that sort of thing.

I've not been able to find anything. My experience in learning .NET so far has been that, if I can't find something simple that feels like it ought to be built-in, I'm not approaching the problem correctly.


No. You can roll your own quite easily, have a look at my post here[^] for ideas.

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900