gpt4 book ai didi

c# - 命名参数规范必须在指定所有固定参数后出现

转载 作者:行者123 更新时间:2023-12-02 04:36:56 25 4
gpt4 key购买 nike

我的这行代码有问题:

return View(unitOfWork.roleRepository.Get(s => s.OrderBy(z => z.Id), Page: 15, p => p.Id == 1, u => u.RoleName != "null"));

此行抛出异常并显示此消息:

named argument specifications must appear after all fixed arguments gave been specified

这里是方法声明:

public virtual IEnumerable<TEntity> Get(
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
int? Page=0,
params Expression<Func<TEntity, bool>>[] filter)

如何修改参数列表以消除此错误?

最佳答案

您应该能够简单地不提供页面参数的名称:

return View(unitOfWork.roleRepository.Get(s => s.OrderBy(z => z.Id), 15, p => p.Id == 1, u => u.RoleName != "null"));

关于c# - 命名参数规范必须在指定所有固定参数后出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21781994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com