Bing API“.Count”属性不起作用?

时间:2011-04-01 20:23:02

标签: c# .net bing bing-api

我一直在尝试使用Bing API恢复20张图片的结果。这是代码:

SearchRequest request = new SearchRequest();
request.AppId = APPID;
request.Query = HttpUtility.HtmlEncode(searchQuery);
request.Sources = new SourceType[] { SourceType.Image };
request.Image = new ImageRequest();
request.Image.Count = 20;
request.Image.Filters = new string[1] { "Size:Medium" };

现在这里的一切都有效,包括Image.Filters属性。不是Count属性。有没有已知的错误,或者我在这里遗漏了什么?

1 个答案:

答案 0 :(得分:2)

我不确定这一点,但我认为您缺少设置CountSpecified属性。试试这个

request.Image = new ImageRequest();
request.Image.Offset = 0;
request.Image.Count = 20;
request.Image.CountSpecified = true;
request.Image.Filters = new string[1] { "Size:Medium" };