title: Capture the output of an Asp.Net Razor expression to a string variable in VB.NET
body: <p>I'm trying to accomplish in VB.Net 4.71 Razor syntax what <a href="https://stackoverflow.com/questions/4296206/razor-how-to-render-content-into-a-variable">this SO question</a> accomplished in C# and it's not quite working.</p>
  
  <p>This is the code I have in my View:</p>
  
  <pre><code>@code
  
      Dim a As Func(Of Object, Object) = Function(item)
               @&lt;text&gt;
          There is text here @item
              &lt;/text&gt;
                                         End Function
  
  @a(0)
  
  End code
  </code></pre>
  
  <p>The line "@a(0)" outputs "There is text here 0" to the web browser which appears to be correct.  When I try something like "Dim HtmlStr = @a(0)" inside the "code" block, I get a syntax error, Razor will not compile it.  How can I capture the output of the expression "@a(0)" to the "HtmlStr" variable?</p>