title: C# 'type' is a variable but is used like a type
body: <p>This code throws an error <code>C# 'type' is a variable but is used like a type</code></p>
  
  <pre><code>Type type = Type.GetType("Objects.Camera");
  for (int i = 0; i &lt; ((List&lt;type&gt;)currentObject).Count; i++)
  {
   //...
  }
  </code></pre>
  
  <p>currentObject is obtained with <code>.GetValue(object)</code> and has type object. I need to cast it to the proper type in order to use it as a list.</p>