title: How to introduce Let keyword inside Linq statement with Group by
body: <p>I have the following Linq statement with 'Group by' clause and would like to know how to introduce a let or any other statement to avoid repeating the sub query, <code>lifecycleEvents.Where(i =&gt; i.LifecycleEventId == grouping.Key).First()</code> in the following example</p>
  
  <pre><code>var completionTimeModels =
      from timeline in processTimelines 
      group timeline by timeline.LifecycleEventId into grouping
      select new CompletionTimeViewModel()
      {
          // How to avoid repeating the same query to find the life cycle event?
          Name = lifecycleEvents.Where(i =&gt; i.LifecycleEventId == grouping.Key).First().LifecycleEventName,
          DisplayName = lifecycleEvents.Where(i =&gt; i.LifecycleEventId == grouping.Key).First().LifecycleEventDisplayName
      };
  </code></pre>