title: C# function for converting string to int with default value parameter
body: <p>So I was expecting to find a definitive equivalent of Delphi's StrToIntDef function on StackOverflow but I can't.</p>
  
  <p>Implement the following...</p>
  
  <pre><code>public static int StrToIntDef(string s, int def)
  {
  
  }
  </code></pre>