title: C# - How to shorten a string
body: <p>I have a piece of code and I need to shorten a string that I have in a variable. I was wondering how could I do this. My code is below.</p>
  
  <pre><code>string test = Console.ReadLine();
  if(string.Length &gt; 5)
  {
      //shorten string
  }
  Console.WriteLine(test);
  Console.ReadLine();
  </code></pre>