Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC#extension methodsSingle-choice MCQ

Two extension methods are in scope for a string. One is a normal instance method on the type, the other is an extension method with the same name and signature. Which is called?

public sealed class Widget { public string Describe() => "instance"; } public static class WidgetExt { public static string Describe(this Widget w) => "extension"; } // ... Console.WriteLine(new Widget().Describe());