0
這使我的大腦融化。鑑於這些簽名IApplicationBuilder
我該如何編寫滿足擴展方法的lambda表達式?如何編寫特定簽名的內聯lambda表達式
public IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware)
擴展方法:(我要滿足這個擴展名)
public static IApplicationBuilder Use(this IApplicationBuilder app, Func<HttpContext, Func<Task>, Task> middleware)
這是我現在有:
app.Map("/home/abc", config =>
{
config.Use(async (context, next) => // this matches Func<RequestDelegate, RequestDelegate>
{
});
});
我不明白怎麼會匹配'Func鍵' 。這樣的lambda只有一個參數,而你有兩個參數。你看到什麼問題?這是一個錯誤嗎?你確定你不是錯過了一個'使用'語句嗎? –
JLRishe