小编Jop*_*Jop的帖子

如何在Action中传递参数?

private void Include(IList<string> includes, Action action)
{
    if (includes != null)
    {
        foreach (var include in includes)
            action(<add include here>);
    }
}
Run Code Online (Sandbox Code Playgroud)

我想这样称呼它

this.Include(includes, _context.Cars.Include(<NEED TO PASS each include to here>));
Run Code Online (Sandbox Code Playgroud)

这个想法是将每个包含传递给方法.

.net c# action

66
推荐指数
3
解决办法
14万
查看次数

标签 统计

.net ×1

action ×1

c# ×1