<p>I'm currently refactoring code to replace Convert.To's to TryParse.</p>

<p>I've come across the following bit of code which is creating and assigning a property to an object.</p>

<pre><code>List&lt;Person&gt; list = new List&lt;Person&gt;();

foreach (DataRow row in dt.Rows)
{
     var p = new Person{ RecordID = Convert.ToInt32(row["ContactID"]) };

     list.Add(p);
}
</code></pre>

<p>What I've come up with as a replacement is:</p>

<pre><code>var p = new Person { RecordID = Int32.TryParse(row["ContactID"].ToString(), out RecordID) ? RecordID : RecordID };
</code></pre>

<p>Any thoughts, opinions, alternatives to what I've done?</p>

Write an extension method.
```
```
public static Int32? ParseInt32(this string str) {
    Int32 k;
    if(Int32.TryParse(str, out k))
        return k;
    return null;
}
```
```