You have some special use case that requires you to reinvent that wheel?
There are several wheels around - http://fluentvalidation.codeplex.com/ just to name one… or are you just prototyping for it’s own sake?
To tell the truth, I do think that someone needs to reform validation, not just within the .NET community, but for development in general.
Most validation frameworks (including every one of the dozens of frameworks I’ve downloaded and tried out) have an unhealthy obsession with data integrity at the expense of the user experience.
To a one, the frameworks wield a binary hammer - everything is either valid or invalid, and nothing invalid may pass, not under any circumstances at all.
Here’s a real world example I heard about just this past weekend: An ecommerce site that requires you to create a customer account before you can purchase. One of the mandatory fields on the customer account is a phone number - and that number must be formatted in the US style: (###) ### ####.
Unfortunately, New Zealand phone numbers aren’t written that way - we have area codes like 03, 09, 021, 029 and 0274, with phone numbers that are six, seven or eight digits long. Oddball? Certainly - but certainly valid as well.
Life isn’t binary - and validation shouldn’t be binary either.
We developers do actually know this - just look at our compilers.
Long past are the days were a compiler would just stop with a cryptic message at the first hint of trouble. Modern compilers are extremely good at error recovery, giving us not just one but a whole set of errors to fix up. Even better, our compilers give us warnings and hints as well, providing us with useful guidance that steers us away from poor practices and helps us write cleaner code.
If we value this kind of guidance so much that we build it into our own tools, why should we treat our users with any less respect?