title: Can you cast an object to a long in c#?
body: <p>I am pulling a 'long' value from Session, using a generic property, and it is crashing.</p>
  
  <p>so I have:</p>
  
  <pre><code>public static T Get&lt;T&gt;(string key)
  {
      if(...)
          return (T)System.Web.HttpContext.Current.Session[key];
  
      ...
  }
  </code></pre>
  
  <p>When debugging, the value is 4, and it crashes.</p>