Fluent Argument Validation
Roger Alsing has written some neat code for argument validation using fluent C# extension methods. Read the "How to validate a method’s arguments?" blog entry. Here's a sample taken from that blog entry.
public static void MyMethod(string someArg,int someOtherArg)
{
someArg.RequireArgument("someArg")
.NotNull()
.ShorterThan(10)
.StartsWith("Roger");
someOtherArg.RequireArgument("someOtherArg")
.InRange(10,100)
.NotEqual(33)
.NotEqual(51)
//do stuff
}
He's also put together some of his other code into a mini-framework for download. The async fork is another another class worth taking a look at for a nice clean way to run asyncronous tasks.