Why do we need Extension Methods?
While designing your classes in .NET projects, we used to have siblings classes which do simple operation from its parent classes to add a kind of customization for parents' methods. Suppose that you want to extend int class in .NET by adding a factorial method to it using recursion technique.
One way of thinking is to inherent int class and adds your new method on it and use your new methods in your code, this is a valid solution but let us see what extension methods can provide us.
Using extension methods
you can use your new methods as a part of int class in .Net
In the above screen shot, I wrote the following line of code:int x = 3;
Factorial method becomes a part of int class by implementing factorial method as an extension method in my class without inheriting int class in .NET.