© Dmitri Nesteruk 2019
Dmitri NesterukDesign Patterns in .NEThttps://doi.org/10.1007/978-1-4842-4366-4_23

23. Strategy

Dmitri Nesteruk1 
St. Petersburg, c.St-Peterburg, 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. In the case of languages such as HTML or LaTeX, though, the list will also need start and end tags or markers.

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

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

  • Render the closing tag or element.

Different strategies can be formulated for different output ...

Get Design Patterns in .NET: Reusable Approaches in C# and F# for Object-Oriented Software Design now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.