Chapter 14. Don’t Try This at Home
Concern over potential code duplication in menus led me to do a little research. That led me to a really cool feature. I think I went down a rat hole—what do you think?
The Idle Brain Is the Devil’s Playground
In looking at the menu method from last time, I can foresee duplication of code. The method looked like this:
void MenuInsertSection(object obj, EventArgs ea) { model.SetLines(textbox.Lines); model.SelectionStart = textbox.SelectionStart; model.InsertSectionTags(); PutText(textbox, model.LinesArray(), model.SelectionStart); }
Now I foresee that lots of insertion methods are coming; I’ve seen the stories. There will be one to insert plain code like the method here, one for those precis things at the top of the ...
Get Extreme Programming Adventures in C# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.