Multiple choice technology architecture

Name the .NET Framework feature that can be used to add a method to pre-compiled classes without using inheritance

  1. Extension methods

  2. Lambda Expression

  3. Anonymous methods

  4. Expression trees

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Extension methods allow adding methods to existing types without modifying the original type or using inheritance. They are defined as static methods in static classes, with the first parameter prefixed by 'this' keyword indicating the type being extended. This provides a clean way to extend functionality of sealed classes or types you don't own.