C#: What method in the string class get only the first n characters?
<p>I'd like to add an extension method to string class so that if the string to display is to long than the width of the container, only a portion of n first characters is displayed.</p>

<p>Here's how it looks like</p>

<pre><code>public static string TruncateLongString(this string str, int maxLength)
{
    if (str.Length &lt;= maxLength)
        return str;
    else
        //return the first maxLength characters                
}
</code></pre>

<p>Thanks for helping</p>
