title: Is there a simple way to determine type size in C#?
body: <p>Is there a way to say something like:</p>
  
  <p>sizeof(type)? Or type.Size? </p>
  
  <p>Right now I am looking at using code like:</p>
  
  <pre><code>if (type.Equals(typeof(int)))
      return sizeof(int);
  else if (type.Equals(typeof(long)))
      return sizeof(long);
  </code></pre>
  
  <p>etc, etc, for every single data type. </p>
  
  <p>There must be an cleaner solution, no?</p>