extension methods in c sharp

Extension Method in C#

Extension Method allows you to add logic in existing classes without modifying them or creating a subclass. You can add functionality to a class that is not in your control, for example .Net classes.

Open closed principle

Open Closed Principle

It states that software entities should be open for extension, but closed for modification. Functionality should be added via extension (e.g. inheritance) instead of directly modifying class.

Coding Crest Back To The Top