title: Using ternary operator to output a string containing whitespace in Razor
body: <p>I'm trying to use a ternary operator in Razor, similar to <a href="https://stackoverflow.com/questions/4091831/how-to-use-ternary-operator-in-razor-specifically-on-html-attributes">this question</a>, but what I want to output contains whitespace. This code</p>
  
  <pre><code>@(selectedGoal == null ? "" : "value=" + selectedGoal.Name)
  </code></pre>
  
  <p>should produce</p>
  
  <pre><code>value="Goal 3"
  </code></pre>
  
  <p>as the value of selectedGoal.Name is "Goal 3". Instead, I get</p>
  
  <pre><code>value="Goal" 3
  </code></pre>
  
  <p>which is no good. I've tried a bunch of different combinations of escaped quotes, @ symbols and no @ symbols, and I just can't get this to work, i.e.</p>
  
  <pre><code>@(selectedGoal == null ? "" : "value=" + "selectedGoal.Name")
  @(selectedGoal == null ? "" : "value=@selectedGoal.Name")
  </code></pre>
  
  <p>and then I just get something like</p>
  
  <pre><code>value="selectedGoal.Name"
  </code></pre>
  
  <p>Anyone know how this should be done?</p>