public static void Main()
var myString = "Hello World!".ToUpper();
Console.WriteLine(myString);
var newString = myString.Shorten(5);
Console.WriteLine(newString);
var newString2 = StringExtensions.Shorten(myString, 5);
Console.WriteLine(newString2);
static class StringExtensions
public static string Shorten(this string text, int length)
return text.Substring(0,length);