1. Home
  2. Computer Science MCQs
  3. C#
  4. Which keyword defines an extension method in C#?

Added 14 Sep 2025

Which keyword defines an extension method in C#?

  1. extend
  2. this Correct answer
  3. static
  4. extends

Correct answer

B. this

15 views

MCQSEXAM

Explanation

In C#, an extension method is a static method in a static class whose first parameter is prefixed with the this keyword, e.g. public static int WordCount(this string s).

Reference

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/ext…

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C# MCQs

Practise all C# MCQs

Similar MCQs