使用 eBay API .NET SDK 分配给 findItemByCategoryRequest.outputSelector[] 时出现问题

发布于 2024-09-17 10:28:32 字数 670 浏览 7 评论 0原文

我正在尝试使用如下代码分配一个值:

findItemByCategoryRequest r = new findItemByCategoryRequest()
r.outputSelector = outputSelectorType.SellerInfo

........etc

但是,当我尝试构建时出现错误:

"Cannot implicitly convert type 'FinalEbayParser.com.ebay.developer.OutputSelectorType'
to 'FinalEbayParser.com.ebay.developer.OutputSelectorType[]'"

现在我期望有一个对象,某种类型的outputSelectorTypes数组..但似乎没有存在于 .NET 的 Ebay Find API 中

有一个 itemFilters (itemFilter[]) ,您可以分配不同数量的项目过滤器,然后将 itemFilter[] 对象分配给属性 r.itemFilter

任何帮助都很多对此表示赞赏,这就是我需要完成的所有工作来签署一个已经过期的项目。 Ebay 网站本身提供的关于在 .NET 中使用 API 的信息非常少,我有一种感觉,这甚至可能是他们完全忘记的事情......显然这发生在过去。

I'm trying to assign a value with code like the following:

findItemByCategoryRequest r = new findItemByCategoryRequest()
r.outputSelector = outputSelectorType.SellerInfo

........etc

However I am getting an error when I try to build:

"Cannot implicitly convert type 'FinalEbayParser.com.ebay.developer.OutputSelectorType'
to 'FinalEbayParser.com.ebay.developer.OutputSelectorType[]'"

Now I would expect there to be an Object, some sort of array of outputSelectorTypes..but one doesn't seem to exist in the Ebay Finding API for .NET

There is such a thing for itemFilters (itemFilter[]) which you can assign a various number of item filters and then assign the itemFilter[] object to the property r.itemFilter

Any help is much appreciated with this, it is all I need working to sign off on a project that is already over due. The Ebay website itself gives very very little info about using the API with .NET and I have a feeling this may even be something they have forgotten completely somehow...Apparently that's happened in the past.

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

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

发布评论

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

评论(1

傲性难收 2024-09-24 10:28:32

您的问题是您试图将单个对象分配给一个属性,该属性是此类对象的数组。现在,我还没有使用过 eBay API,所以我不知道它到底是如何工作的,但你可以尝试分配一个数组:

r.outputSelector = new[] { outputSelectorType.SellerInfo };

如果你使用的 C# 版本不支持类型推断,你将需要显式地声明数组类型:

r.outputSelector = new OutputSelectorType[] { outputSelectorType.SellerInfo };

Your problem is that you are trying to assign a single object to a property that is an array of such objects. Now, I haven't used the eBay API, so I don't know exactly how it works, but you could try to assign an array instead:

r.outputSelector = new[] { outputSelectorType.SellerInfo };

If you are using a C# version that does not support type inference you will need to explicitly state the array type:

r.outputSelector = new OutputSelectorType[] { outputSelectorType.SellerInfo };
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文