title: Cannot implicitly convert type 'System.Linq.IQueryable<TMS.Models.CustomAsset>' to 'System.Collections.Generic.ICollection
body: <p>I have the following model class :-</p>
  
  <pre><code>public class CustomerCustomAssetJoin
  {
      public CustomAsset CustomAsset  { get; set; }
      public ICollection&lt;CustomAsset&gt; CustomAssets { get; set; }
  
  } 
  </code></pre>
  
  <p>But when i wrote the following method:-</p>
  
  <pre><code>public CustomerCustomAssetJoin CustomerCustomAsset(string customerName)
  {
      var customerAssets = tms.CustomAssets.Include(a =&gt; a.CustomAssetType).Where(a =&gt; a.CustomerName.ToLower() == customerName.ToLower());
      CustomerCustomAssetJoin caj = new CustomerCustomAssetJoin
      {
           CustomAsset = new CustomAsset {CustomerName = customerName },
           CustomAssets = customerAssets
      };
      return caj;  
   }
  </code></pre>
  
  <p>I got the following exception :</p>
  
  <blockquote>
    <p>Error 20  Cannot implicitly convert type
    'System.Linq.IQueryable' to
    'System.Collections.Generic.ICollection'. An
    explicit conversion exists (are you missing a cast?)</p>
  </blockquote>
  
  <p>So what is causing this error? To overcome this error i just add a .toList() as follows:</p>
  
  <pre><code>var customerAssets = tms.CustomAssets.Include(a =&gt; a.CustomAssetType).Where(a =&gt; a.CustomerName.ToLower() == customerName.ToLower());
  </code></pre>
  
  <p>So why do I have to convert it to a list?</p>