# Monday, March 10, 2008
« Outlook Empty Subject Fix | Main | Less work, more reading »

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.

Comments are closed.