title: Declare variable within LINQ select(x => new
body: <p>I'm mapping a POCO into a model, code shown below.</p>
  
  <pre><code>// NOT NEEDED var noneRequiredUserDocuments = new List&lt;NoneRequiredUserDocument&gt;();
  //var docs = studentDocuments.Where(x =&gt; x.RequiredUserDocumentId == null); // NOT NEEDED .ToList();
  //var noneRequiredUserDocuments = docs.Select(x =&gt; new NoneRequiredUserDocument
  
  // You can chain LINQ methods (i.e. Where and Select)
  var noneRequiredUserDocuments = studentDocuments
      .Where(x =&gt; x.RequiredUserDocumentId == null)
      .Select(x =&gt; new NoneRequiredUserDocument
      {
          StudentDocument = x,
          Src = _storageService.GetFileUrl(x.FileName),
          ThumbnailImageUrl = ImageHelper.ThumbnailImageUrl(Src, 75)
  
      }).ToList();
  </code></pre>
  
  <p>My problem is that in this line:</p>
  
  <pre><code>ThumbnailImageUrl = ImageHelper.ThumbnailImageUrl(Src, 75)
  </code></pre>
  
  <p><code>Src</code> doesn't exist in the context.</p>
  
  <p><strong>Is there a way for me to declare a variable within the select that I can the reuse within the LINQ select?</strong></p>
  
  <p>And I don't want to call <code>_storageService.GetFileUrl</code> twice.</p>