title: how to get byte size of type in generic list?
body: <p>I have this generic list and I want to get the byte size of the type like if T is string or int etc., I tried both ways as written in getByteSize(), and just to let you know I am using only one way at a time ... </p>
  
  <p>but when I try to compile, it gives an error saying "Error: The type or namespace name 'typeParameterType' could not be found (are you missing a using directive or an assembly reference?)"</p>
  
  <pre><code>public class iList&lt;T&gt; : List&lt;T&gt; 
      { 
          public int getByteSize ()
          {
              // way 1
              Type typeParameterType = typeof(T);
              return sizeof(typeParameterType);
  
              // way 2
              Type typeParameterType = this.GetType().GetGenericArguments()[0];
              return sizeof(typeParameterType);
          }
      }
  </code></pre>
  
  <p>And idea what I am doing wrong here?</p>