The
x => Url.Action("List",
new { page = x,
sort = Request.QueryString["sort"],
desc = Request.QueryString["desc"] })
is still a lambda expression that denotes a method that expects one parameter. The fact that in the method body you create an anonymous object with three properties is irrelevant.
You want to change it to
(x, y, z) => Url.Action("List",
new { page = x,
sort = y,
desc = z }))
This way when you invoke it as
pageUrl(i, pagingInfo.Sort, pagingInfo.Desc.ToString())
all three ( i
, pagingInfo.Sort
and paginginInfo.Desc.ToString()
) will be captured by consecutive parameters (x
, y
and z
). I would even recommend renaming for clarity:
(pageNumber, sortOrder, descending) => Url.Action("List",
new { page = pageNumber, sort = sortOrder, desc = descending }))