I realized that in almost every project I work on I end up defining a small preconditions assertion library. I got tired of doing that, so I created a very small argument preconditions library. That's all this library does - preconditions, that way I can add this to any project without any other baggage to go along with it.
I wanted the precondition library to be readable and short. This is what I came up with:
Throw.If(regexExpression).IsEmpty();
Throw.If(instance).IsNull();
I think it intention revealing and short to write (especially with intellisense) than traditional precondition checks. Another nice thing is that is type safe/smart, so only string arguments get string related precondition checks - like IsEmpty().
I checked it into my SVN repository on Google code.
Powered by: newtelligence dasBlog 2.1.8102.813
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Shawn Neal
E-mail