public static async ValueTask InvokeAllAsync <T>(this Func <IServiceProvider, T, ValueTask> handler, IServiceProvider services, T t) { if (handler == null) { return; } var list = handler.GetInvocationList().Cast <Func <IServiceProvider, T, ValueTask> >(); foreach (var func in list) { await func(services, t); } }