using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication4 { class Program { static void Main(string[] args) { String s = "aaaa"; Console.WriteLine(s.extendMethod(true)); Console.WriteLine(ExtendClass.extendMethod(s, false)); Console.Read(); } } static class ExtendClass { public static string extendMethod(this string s,bool isLong) { if (isLong) return "Long"; else return "Short"; } } }