在指定了所有固定参数后,必须出现命名参数规范(named argument specifications must appear after all fixed arguments gave been

编程入门 行业动态 更新时间:2024-10-19 18:37:17
在指定了所有固定参数后,必须出现命名参数规范(named argument specifications must appear after all fixed arguments gave been specified)

我的代码行有问题:

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

此行会抛出此消息的异常:

在指定了所有固定参数后,必须出现命名参数规范

这是方法声明:

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

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

I have problems with this line of my code:

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

this line throws an exception with this message:

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

And here is the method declaration:

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

How can I modify my argument list to get rid of this error?

最满意答案

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

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

You should be able to simply not provide the name of the page argument:

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

更多推荐

本文发布于:2023-08-01 13:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1359175.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   argument   named   specifications   arguments

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!