What is the difference between Extension methods and a Decorator

Although both Decorator and Extension method try to extend the functionality of an existing component without having to modify it, the way they do is different.

  • A decorator wraps an existing functionality to enhance a new functionality,
  • An extension method is syntactical sugar to a static method that is extended over an existing type.

C# Concepts Posted May 14, 2021

You can now show your support. 😊

We use cookies to provide you with a great user experience, analyze traffic and serve targeted promotions.   Learn More   Accept