title: Unable to cast object of type 'System.Linq.OrderedEnumerable`2[***]' to type 'System.Collections.Generic.IEnumerable`1[***]'
body: <p>I have an object <code>DirectoryToken</code> that inherits from the class <code>Token</code>. In my code I have a <code>GetValues</code> method which takes a list of tokens, and puts together the value for each item in the list based on the information contained in the token object. </p>
  
  <pre><code>//NameTokens is an object of type **List&lt;DirectoryToken&gt;**
  List&lt;String&gt; PathValues = GetValues((IEnumerable&lt;Token&gt;)settings.DirectoryDefinition.**NameTokens**.OrderBy(x =&gt; x.Index));
  
  
  private List&lt;String&gt; GetReportValues(IEnumerable&lt;Token&gt; TokenList)
  {
  
  }
  </code></pre>
  
  <p>What I notice is when I run the code on one machine (Windows 7, .NET 3.5), it runs fine. However, when I move the built msi to another machine and try to run the same test, I get the following error message. </p>
  
  <blockquote>
    <p>Unable to cast object of type 'System.Linq.OrderedEnumerable<code>2[DirectoryToken,System.Int32]' to type 'System.Collections.Generic.IEnumerable</code>1[Token]'.</p>
  </blockquote>
  
  <p>I don't think changing the code is the right way to attack this issue. Any suggestions what this problem could be from and maybe what version I can update my 3.5 to, to remedy this? </p>