title: Contract.Requires for validations in web api
body: <p>I am developing MVC5 / Web API based application. In some articles I have read use <code>Contract.Requires</code> (part of the <code>System.Diagnostics.Contracts</code> namespace) for validating the incoming data.</p>
  
  <p>Is this the correct way of validating the incoming data? Also I am not able to debug the <code>Contract.Requires</code> line as the debugger always bypasses this line. I am using Visual Studio 2013.</p>
  
  <pre><code>    public async Task&lt;UserInfo&gt; Put(
          [FromBody] UserInfo userInfo) {
          Contract.Requires(userInfo != null);
          ..............
       }
  </code></pre>
  
  <p>Can someone explain when to use <code>Contract.Requires</code> and where to avoid?</p>