.NET Guard Class Library?
I'm looking for a library or source code that provides guard methods such as checking for null arguments. Obviously this is rather simple to build, but I'm wondering if there are any out there for .NET already. A basic Google search didn't reveal much. There is CuttingEdge.Conditions . Usage example from the page: public ICollection GetData(Nullable<int> id, string xml, ICollection col) { // Check all preconditions: id.Requires("id") .IsNotNull() // throws ArgumentNullException on failure .IsInRange(1, 999) // ArgumentOutOfRangeException on failure .IsNotEqualTo(128); // throws