© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
D. NesterukDesign Patterns in .NET 6https://doi.org/10.1007/978-1-4842-8245-8_24

24. Strategy

Dmitri Nesteruk1  
(1)
St. Petersburg, c.St-Petersburg, Russia
 
Suppose you decide to take an array or vector of several strings and output them as a list:
  • just

  • like

  • this

If you think about the different output formats, you probably know that you need to take each element and output it with some additional markup. But in the case of languages such as HTML or LaTeX, the list will also need the start and end tags or markers.

We can formulate a strategy for rendering a list:
  • Render the opening tag/element.

  • For each of the list items, render that item.

  • Render the closing tag/element. ...

Get Design Patterns in .NET 6: Reusable Approaches in C# and F# for Object-Oriented Software Design 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.