title: What should I do about "Possible compare of value type with 'null'"?
body: <p>While writing this method for a custom NUnit Constraint.</p>
  
  <pre><code>    private void AddMatchFailure&lt;TExpected, TActual&gt;(string failureName, TExpected expected, TActual actual)
      {
          _matchFailures.Add(
              String.Format(MatchFailureFormat, failureName,
              (expected == null) ? "null" : expected.ToString(),
              (actual == null) ? "null" : actual.ToString()));
      }
  </code></pre>
  
  <p>Resharper warns that <code>expected</code> and <code>actual</code> might be <code>ValueType</code> objects.</p>
  
  <pre>
  e.g. TExpected is DateTime
     expected == null;//  but DateTime is a struct.
  </pre>
  
  <p>What are the rules when comparing a ValueType to null and how should I write the method to account for that without limiting the generic parameters by adding a class constraint?</p>