<p>I have a generic method with this (dummy) code (yes I'm aware IList has predicates, but my code is not using IList but some other collection, anyway this is irrelevant for the question...)</p>
<pre class="lang-cs prettyprint-override"><code>    static T FindThing&lt;T&gt;(IList collection, int id) where T : IThing, new()
    {
        foreach (T thing in collection)
        {
            if (thing.Id == id)
                return thing;
        }
        return null;  // ERROR: Cannot convert null to type parameter 'T' because it could be a value type. Consider using 'default(T)' instead.
    }
</code></pre>
<p>This gives me a build error</p>
<blockquote>
<p>&quot;Cannot convert null to type parameter
'T' because it could be a value type.
Consider using 'default(T)' instead.&quot;</p>
</blockquote>
<p>Can I avoid this error?</p>

```
```
return default(T);
```
```