Visitor: Implementation and Example
Explore how to implement the Visitor design pattern in C# to extend the functionality of HTML converters without modifying existing components. Understand how this pattern allows adding new behaviors like converting HTML to Markdown by enabling objects to accept visitor operations, ensuring maintainable and flexible code within behavioral design patterns.
We'll cover the following...
We'll cover the following...
Problem statement
Let’s imagine that we have a library that’s capable of converting between some basic HTML and plain text. However, we realize it doesn’t deal with all HTML element types. Then we realize that we don’t want to just deal with plain text. We want to convert between HTML and Markdown.
But the problem is that we can’t change the original functionality because this will ...