static void Main(string[] args) { var ft = new FormattedText("This is a barve new wolrd"); ft.Capitalize(10, 15); Console.WriteLine(ft.ToString()); var bft = new BetterFormattedText("This is a barve new wolrd"); bft.GetRange(10, 15).Capitalize = true; Console.WriteLine(bft.ToString()); }
static void Main(string[] args) { var ft = new FormattedText("This is a brave new world"); ft.Capitalize(10, 15); WriteLine(ft); // flyweight --> not waisting memory var bft = new BetterFormattedText("This is a brave new world"); bft.GetRange(10, 15).Capitalize = true; WriteLine(bft); }