Multiple choice technology platforms and products

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. Abstract methods

  4. Expression trees

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

Extension methods, introduced in C# 3.0, allow adding methods to existing compiled classes without using inheritance or modifying the original class. They are static methods with special syntax that appear as instance methods of the extended type. Lambda expressions, abstract methods, and expression trees serve different purposes.