title: Unbox value of type object to long
body: <p>I had a variable of type object and I wanted to convert it to int in advance.?</p>
  
  <p>prev code</p>
  
  <pre><code>val = Math.Max(((int)DatabaseHelper.ExecuteScalerCommand(query)), numbering.StartValue);
  </code></pre>
  
  <p>Now I need to convert it to type long. I try to use <code>long.tryparse()</code></p>
  
  <pre><code>long t = 0;
  long.TryParse(DatabaseHelper.ExecuteScalerCommand(query).ToString(), out t);
  var val = Math.Max(t, numbering.StartValue);
  </code></pre>
  
  <p>is there a better way to handle this problem?</p>