Benny Sutton is 4 hire - just click here

Extension method to Truncate a string

Limit string length - very handy so you don't accidentally try to save 1000 characters into a field that only takes 255!

           
       public static string Truncate(this string value, int maxLength)
        {
            if (string.IsNullOrEmpty(value)) return value;
            return value.Length <= maxLength ? value : value.Substring(0, maxLength);
        }        
    

Extension methods are easy to chain, simply call like this...

         
            return String.Join(" ", KeywordList(text)).Truncate(4000);