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

Why does the second call fail to compile?

static class Ext { public static T Mid<T>(this IList<T> list) => list[list.Count / 2]; } var nums = new[] { 1, 2, 3 }; int m = nums.Mid(); // (1) compiles IEnumerable<int> seq = nums; int n = seq.Mid(); // (2)