title: Cast object to IEnumerable
body: <pre><code>object selectedDataItem;
  MyClass.Inventory inventory;
  inventory = (MyClass.Inventory) selectedDataItem;
  </code></pre>
  
  <p>in <code>inventory</code> we can see the details such as:</p>
  
  <pre><code>Trace.Writeline(inventory.Name + " " + inventory.Place);
  </code></pre>
  
  <p>You see inventory has inventory.Name, Inventory.Place I want to wrap all of the property inside IEnumerable or ObservableCollection so that I can iterate through all of the inventory at once and not by inventory.Name, inventory.Place etc etc...</p>
  
  <p>How can I make inventory <code>IEnumerable</code> so that I can do something like this :</p>
  
  <pre><code>IEnumerable&lt;MyClass.Inventory&gt; enumerable = (IEnumerable&lt;MyClass.Inventory&gt;) inventory;
  enumerable = from x in enumerable where x.Name == inventory.Name select x;
  </code></pre>
  
  <p>Right now if I do this the error is </p>
  
  <blockquote>
    <p>Unable to cast object of type 'MyClass.Inventory' to type 'System.Collections.Generic.IEnumerable`1[MyClass.Inventory]'.</p>
  </blockquote>