title: How to extend C# built-in types, like String?
body: <p>Greetings everyone... I need to <code>Trim</code> a <code>String</code>. But I want to remove all the repeated blank spaces within the String itself, not only at the end or at the start of it. I could do it with a method like:</p>
  
  <pre><code>public static string ConvertWhitespacesToSingleSpaces(string value)
  {
      value = Regex.Replace(value, @"\s+", " ");
  }
  </code></pre>
  
  <p>Which I got from <a href="http://dotnetperls.com/whitespace" rel="noreferrer">here</a>. But I want this piece of code to be called within the <code>String.Trim()</code> itself, so I think I need to extend or overload or override the <code>Trim</code> method... Is there a way to do that?</p>
  
  <p>Thanks in advance.</p>