title: Put LINQ Query in Method with Property as Parameter
body: <p>I didnt know how to explain in the title, so I describe my concern as detailed as possible:</p>
  <p>I have a list of object with different properties and I group them via a property named &quot;OriginID&quot; with a LINQ query to get a sum of different properties (NetTotal and ShippingCost).</p>
  <p>As I have multiple properties to get the sum of, I now need to copy the LINQ Query for each group element (I have more field like &quot;OriginID&quot; e.g. CountryID and so on.</p>
  <pre><code>Dim ListA = SalesTurnoverResult.GroupBy(
      Function(x) x.OriginID).Select(
      Function(a) New With {
          Key .OriginID = a.Key,
          Key .sum_a = a.Sum(Function(s) s.NetTotal),
          Key .sum_b = a.Sum(Function(s) s.ShippingCost)})
  </code></pre>
  <p>I would like to encapsule the &quot;one&quot; query into a function where the group - which is the property of the object - can be given as parameter like so:</p>
  <pre><code>Public SubGetGroupedSummary(NameOfProperty As .... [the property])
      Dim ListA = SalesTurnoverResult.GroupBy(
          Function(x) x.[NameOfProperty]).Select(
          Function(a) New With {
              Key .OriginID = a.Key,
              Key .sum_a = a.Sum(Function(s) s.NetTotal),
              Key .sum_b = a.Sum(Function(s) s.ShippingCost)})
  End Sub
  </code></pre>
  <p>Is it even possible to do so?</p>
  <p>I add some more details:</p>
  <pre><code>Public SalesTurnoverResult As List(Of SummaryClass)
  
  'The (Sample)Class
  Public Class SummaryClass
      Public Property NetTotal As Single'Sum
      Public Property ShippingCost As Single'Sum
  
      Public Property InvoiceCountry As Integer'Group
      Public Property OriginID As Single'Group
  End Class
  </code></pre>