.NET Framework Preconditions


Example

Preconditions allows methods to provide minimum required values for input parameters

Example...

void DoWork(string input)
{
    Contract.Requires(!string.IsNullOrEmpty(input));

    //do work
}

Static Analysis Result...

enter image description here