title: How to cast an object value to Type values?
body: <p>I have a type like this:</p>
  
  <pre><code>public class TypeValue
  {
      public Type Type { get; private set; }
      public object Value { get; private set; }
  }
  </code></pre>
  
  <p>so I can do something like:</p>
  
  <pre><code>TypeValue tv = ...
  int count = (tv.Type) tv.Value;
  </code></pre>
  
  <p>but the compiler is giving me this error:</p>
  
  <blockquote>
    <p>The type or namespace name 'tv' could
    not be found (are you missing a using
    directive or an assembly reference?)</p>
  </blockquote>
  
  <p>How do I achieve this?</p>