Everything in the .NET framework should be open for extension. Extension, not change. The idea behind this is that you have an existing class that does what it should, and works how it should, and it is not a good idea to change the contents. But if you do want to change something…? And that’s where C# extension methods make an entrance.
In this article, I am going to tell you what extension methods are, how you can use them, how you can create your own, and how you can unit test them.
Read more here: https://kenslearningcurve.com/tutorials/c-extension-methods-tutorial/