Bing API“.Count”财产不工作?

发布于 2024-10-28 18:41:01 字数 449 浏览 1 评论 0原文

我一直在尝试使用 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 属性。是否存在已知的错误,或者我只是在这里遗漏了一些东西?

I have been trying to bring back 20 results of images using the Bing API. Here's the code:

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" };

Now everything on here works, including the Image.Filters property. Just not the Count property. Is there a known bug or am I just missing something here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落墨 2024-11-04 18:41:01

我不确定这一点,但我认为您缺少设置 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" };

I'm not sure really sure about this but I think you are missing setting CountSpecified property. Try this

request.Image = new ImageRequest();
request.Image.Offset = 0;
request.Image.Count = 20;
request.Image.CountSpecified = true;
request.Image.Filters = new string[1] { "Size:Medium" };
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文