title: c# String concatenation of string property on viewModel List object using linq to be displayed on a MVC View
body: <p>I have looked on SO for a solution to my problem, but have not seen anything that comes close.</p>
  
  <p>I have an object:</p>
  
  <pre><code>public class MyTestObject()
  {
      public int Id {get;set;}
      public string Description {get;set;}
      public IList&lt;Event&gt; Events {get;set;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Event()
  {
      public int Id {get;set;}
      public int Type {get;set;}
      public string EventName {get;set;}
  }
  </code></pre>
  
  <p>What I am trying to do is concatenate the EventName properties from the Event class into a single string separated with a newline.</p>
  
  <pre><code>string test = string.Join(Environment.NewLine, MyTestObject.Events.Where(x =&gt; 
  x.Type == 99).Select(x =&gt; x.Reference));
  </code></pre>
  
  <p>This produces a concatenated string, but the newline is not recognised. The string is to be displayed in a div on an MVC page.</p>
  
  <p>I have replaced Environment.Newline for <code>&lt;br/&gt;</code>, which just adds the text string <code>&lt;br/&gt;</code> in between the joined strings.</p>
  
  <p>Example</p>
  
  <pre><code>text1&lt;br /&gt;text2
  </code></pre>
  
  <p>Next I tried:</p>
  
  <pre><code>string test = string.Join("", MyTestObject.Events.Where(x =&gt; 
  x.Type == 99).Select(x =&gt; x.Reference + " Boo"));
  </code></pre>
  
  <p>Which gave me:</p>
  
  <pre><code>text1Bootext2Boo
  </code></pre>
  
  <p>So logic prevailed and I tried </p>
  
  <pre><code>string test = string.Join("", MyTestObject.Events.Where(x =&gt; 
  x.Type == 99).Select(x =&gt; x.Reference + Environment.NewLine));
  </code></pre>
  
  <p>Then I looked at the html to see that a new line had been added, but not displayed in the browser.</p>
  
  <p>Should I be using a particular style on the div to make it see the line break?</p>