title: Better way to convert IEnumerable<T> to user type
body: <p>I have a custom collection type, defined as such:</p>
  
  <pre><code>public abstract class RigCollectionBase&lt;T&gt; : Collection&lt;T&gt;, IEnumerable&lt;T&gt;, INotifyPropertyChanged, IBindingList, ICancelAddNew where T : BusinessObjectBase, new()
  </code></pre>
  
  <p>Note: this is the base class, there are 20 or so child classes that are implemented like so:</p>
  
  <pre><code>public class MyCollection : RigCollectionBase&lt;MyObject&gt;
  </code></pre>
  
  <p>We use a lot of Linq in our code, and as you probably know, Linq functions return <code>IEnumerable&lt;T&gt;</code>.  What I'm looking for, is an easy and simple way to go back to <code>MyCollection</code> from <code>IEumberable&lt;MyObject&gt;</code>.  Casting is not allowed, I get the exception "Cannot cast from ..."</p>
  
  <p>Here is the answer I came up with, and it <em>does</em> work, but it seems kind of clunky and...overcomplicated.  Maybe its not, but I figured I would get this out there to see if there's a better way.</p>
  
  <pre><code>public static class Extension
  {
      /// &lt;summary&gt;
      /// Turn your IEnumerable into a RigCollection
      /// &lt;/summary&gt;
      /// &lt;typeparam name="T"&gt;The Collection type&lt;/typeparam&gt;
      /// &lt;typeparam name="U"&gt;The Type of the object in the collection&lt;/typeparam&gt;
      /// &lt;param name="col"&gt;&lt;/param&gt;
      /// &lt;returns&gt;&lt;/returns&gt;
      public static T MakeRigCollection&lt;T, U&gt; (this IEnumerable&lt;U&gt; col) where T : RigCollectionBase&lt;U&gt;, new() where U : BusinessObjectBase, new()
      {
          T retCol = new T();
  
          foreach (U myObj in col)
              retCol.Add(myObj);
  
          return retCol;
      }
  }
  </code></pre>
  
  <p>What I'm really looking for, I guess, is this.  Is there a way to implement the base class so that I can use a simple cast to go from IEnumerable into MyCollection...</p>
  
  <pre><code>var LinqResult = oldCol.Where(a=&gt; someCondition);
  MyCollection newCol = (MyCollection)LinqResult;
  </code></pre>
  
  <p>No, the above code doesn't work, and I'm actually not 100% certain why that is...but it doesn't.  It just feels like there is some very obvious step that I'm not seeing....</p>