无法从派生类型列表访问扩展方法

Extension method not accessible from list of derived type

我正在为自己做一个小练习项目,我试图在我的测试中调用这个扩展方法

var days = account.Transactions.PassDays(10, Today);

这给了我这个错误

CS1929    'List<Transaction>' does not contain a definition for 'PassDays' and the best extension method overload 'PassTime.PassDays(List<Event>, int, DateTime)' requires a receiver of type 'List<Event>'

using语句高亮显示,扩展方法声明为

public static IEnumerable<Day> PassDays(this List<Event> events, int daysToPass, DateTime startTime)

我尝试在其上使用它的列表属于从事件 class 派生的 class。我读过的所有内容都表明这应该有效。

public record Transaction : Event
public record Event : IEvent

使用

public static IEnumerable<Day> PassDays(this IEnumerable<IEvent> events, int daysToPass, DateTime startTime)

修复了这个问题。 (IEvent 对此不是必需的,但我做出更改是因为预期它会更有用)也许其他人可以解释为什么这样做有效。