How can I return two fields using Linq on an object with more than two fields?
<p>What I would like to do is something I find common in MySQL which is to select all of one field distinct, and a sum of another field in that data sub-set for each unique/distinct result.</p>

<p>Following should replicate something simple to use in order to see the type of data I mean :</p>

<pre><code>public class Stock {
   public int id {get;set;}
   public int count {get;set;}
   public string location {get;set;}
   public Stock() { }
}

public class Foo {

   public void Bar() {
        List&lt;Stock&gt; Stocks = new List&lt;Stock&gt;()
        {
            new Stock
            {
                id = 137829,
                count = 5,
                location = "Ottawa"
            },
            new Stock
            {
                id = 137829,
                count = 27,
                location = "Toronto"
            },
            new Stock
            {
                id = 137830,
                count = 8,
                location = "Toronto"
            }

        };

        var result = Stocks.DistincyBy( s =&gt; s.id);
   }
}
</code></pre>

<p>What I would like to store in <code>result</code> is as follows (using this code as an example. the real project the structure is more complex).</p>

<ul>
<li>id = 137829, count = 32</li>
<li>id = 137830, count = 8</li>
</ul>

<p>I know I can use <code>.Sum()</code>, but in this scenario I wish to sum where one field is distinct. How can this be achieved (i prefer my Linq to be inline syntax rather than sql style querying)</p>