**I was wondering how the the compiler/runtime determines a lambda expression's type?**

For example, the following `System.Linq` `Select` extension method (not select query)

```
//var recordIds = new List<int>(records.Select(r => r?.RecordId ?? 0));
//var recordIds = new List<int>(records.Where(r => r != null).Select(r => r.RecordId));
var recordIds = new List<int>(records.Select(r => r.RecordId));

```

is defined as

[`Enumerable.Select<TSource, TResult> Method (IEnumerable<TSource>, Func<TSource, TResult>)`](https://msdn.microsoft.com/en-us/library/bb548891(v=vs.110).aspx) 

and so takes the lambda `r => r.RecordId` as a `Func<TSource, TResult>`. 

**How is the lambda's type determined, and once it is, is it simply cast to that type?**