开发者

Use Take() to get a limited number of results but also get the potential total

开发者 https://www.devze.com 2022-12-20 03:50 出处:网络
Given the following... int maxResults = 25; string code = \"Thailand\"; var q = fro开发者_StackOverflow社区m i in images where i.component_code == code select i;

Given the following...

int maxResults = 25;
string code = "Thailand";

var q = fro开发者_StackOverflow社区m i in images where i.component_code == code select i;

var images = q.OrderByDescending(x => x.image_rating).Take(maxResults);

if (images.Count() > 0)
{
    ...

    lblResult = string.Format("Viewing {0} Images Of A Possible {1}", images.Count(), ?);
}

How do I get the potential total number of images that would have been returned if Take() had not been used


Can't you use q.Count() for this?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号