开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜