📜  mvc invalidOperationException:视图组件的方法“InvokeAsync”应声明为返回任务<t>- C# 代码示例

📅  最后修改于: 2022-03-11 14:49:24.006000             🧑  作者: Mango

代码示例1
public class ExampleViewComponent : ViewComponent {
    public Task InvokeAsync() {
        ExampleModel model = new ExampleModel(2);

        // returns a finished task
        return Task.FromResult(View(model));
    }
}