title: Delete duplicates from TextBox, if line after = line before
body: <p>I have a TextBox and want to delete lines if line before = line after.</p>
  
  <p>I have Text like that:</p>
  
  <pre><code>Ab cd ...
  
  Ef Gss ...
  EE oo ...
  EE oo ... // delete this line
  qq ss ff
  
  ok ee ..
  </code></pre>
  
  <p>I tried with many codes but it removed me all same lines. I just want to remove next same line. Empty lines should be always there.</p>
  
  <p>Code I used:</p>
  
  <pre><code>richTextBox1.Text = string.Join( Environment.NewLine, richTextBox1.Lines.Distinct()); 
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>for (int tx = 0; tx &lt; richTextBox1.Text.Length; tx++)
          {
              for (int tx1 = tx + 1; tx1 &lt; richTextBox1.Text.Length; tx1++)
              {
                  if (richTextBox1.Lines[tx] == richTextBox1.Lines[tx1])
                     // something like  richTextBox1.Lines[tx1].RemoveAt(tx1);
              }
          }
  </code></pre>