Extension methods in C#: Everything You Need To Learn (2023)

Extension Methods in C#
Extension Methods in C#

An extension method in C# is a feature that allows you to inject new methods into existing classes without changing their source code. 

It allows you to create additional methods that can be used as if they were a regular method of the original class. 

Extension methods are static methods defined in a static class. They use the “this” keyword with the first parameter, representing the type extended by the extension method.