title: How to truncate or pad a string to a fixed length in c#
body: <p>Is there a one-liner way of setting a <code>string</code> to a <em>fixed length</em> (in C#), either by <em>truncating</em> it or <em>padding</em> it with spaces (<code>' '</code>).</p>
  
  <p>For example:</p>
  
  <pre><code>string s1 = "abcdef";
  string s2 = "abc";
  </code></pre>
  
  <p>after setting both to length <code>5</code>, we should have:</p>
  
  <pre><code>"abcde"
  "abc  "
  </code></pre>