title: Nested multi-line lambda Function as parameter for LINQ Select is causing an error
body: <p>I'm trying to use a nested multi-line lambda <code>Function</code> in VB.NET and am getting an error.  Here's what my code looks like:</p>
  
  <pre><code>cartItems = cartItems.Select(Function(ci) New With {.CartItem = ci, .Discount = discountItems.FirstOrDefault(Function(di) di.SKU = ci.SKU)}) 
  .Select(Function(k)
              If k.Discount Is Not Nothing Then
                  k.CartItem.Discount = minNumberOfItemsDiscounted * k.Discount.DiscountAmount
              End If
              Return k.CartItem
          End Function)
  </code></pre>
  
  <p>And here's the long error message:</p>
  
  <pre><code>Error   1   Overload resolution failed because no accessible 'Select' can be called with these arguments:
      Extension method 'Public Function Select(Of TResult)(selector As System.Func(Of &lt;anonymous type&gt;, Integer, TResult)) As System.Collections.Generic.IEnumerable(Of TResult)' defined in 'System.Linq.Enumerable': Nested function does not have a signature that is compatible with delegate 'System.Func(Of &lt;anonymous type&gt;, Integer, TResult)'.
      Extension method 'Public Function Select(Of TResult)(selector As System.Func(Of &lt;anonymous type&gt;, Integer, TResult)) As System.Collections.Generic.IEnumerable(Of TResult)' defined in 'System.Linq.Enumerable': Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.
      Extension method 'Public Function Select(Of TResult)(selector As System.Func(Of &lt;anonymous type&gt;, TResult)) As System.Collections.Generic.IEnumerable(Of TResult)' defined in 'System.Linq.Enumerable': 'Is' operator does not accept operands of type 'Integer'. Operands must be reference or nullable types.
      Extension method 'Public Function Select(Of TResult)(selector As System.Func(Of &lt;anonymous type&gt;, TResult)) As System.Collections.Generic.IEnumerable(Of TResult)' defined in 'System.Linq.Enumerable': Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error. C:\_Dev Projects\CMS2000\Components\NET\HBCatalogPromo\CatalogPromotion\CatalogPromotion.ConsoleTest\Module1.vb 88  21  CatalogPromotion.ConsoleTest
  </code></pre>
  
  <p>It feels like I have something wrong with my syntax because I've fixed other lines by collapsing in line <code>Functions</code> on to one line when possible.  However, I can't do that in this case.</p>