C# query in Linq : <p>I'm using C# in Visual Studio 2015.
I have a <code>List&lt;MagicItem&gt; magicItemList</code> and I'm trying to do a simple query using Linq to fetch an Object that matches the Id that the user inputs.
This is my code:</p>

<pre><code>int itemId = Convert.ToInt32(Console.ReadLine());

var query = from MagicItem magicItem in magicItemList
                where magicItem.Id == itemId
                select magicItem;
</code></pre>

<p>The thing that confuses me is that <code>query</code>'s type is <code>System.Collections.Generic.IEnumerable</code>, so I can't fetch any of its attributes as a normal Object.</p>

<p>Is there a way to cast it so I can use it as a normal Object? Thanks in advance.</p>

<p>This is my MagicItem Class:</p>

<pre><code>class MagicItem
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public int StockLevel { get; set; }
    }
</code></pre>
