.net 远程处理 - List 的问题

发布于 2024-08-09 19:44:42 字数 168 浏览 3 评论 0 原文

我正在使用 .Net Remoting 开发客户端-服务器应用程序。我想从我的服务器返回一个列表以响应某个方法调用,但是我收到一个异常,说 SoapFormatter 基本上无法处理泛型。我需要一种解决方法,以便能够使用泛型,或者指导如何使用 XmlSerializer 或 DataContractSerializer。

I am developing a client-server application using .Net Remoting. From my server I want to return a List in response to a certain method call, however I get an exception saying that basically SoapFormatter cannot deal with generics. I need a workaround so that I am able to work with generics, or direction on how to use XmlSerializer or DataContractSerializer.

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

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

发布评论

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

评论(1

离线来电— 2024-08-16 19:44:42

这是因为他们没有在 .NET 2.0 中添加对 SoapFormatter 和泛型的任何额外支持。一个快速的解决方法是将列表作为数组传递给客户端。

如果您必须使用泛型(我个人会考虑将其升级到 WCF),MSDN 远程处理示例

That's cause they didn't add any additional support for the SoapFormatter and generics in .NET 2.0. A quick workaround would be to pass the List to the client as an array.

If you must use Generics (personally I'd consider upgrading this to WCF), there are some examples on how to do so in the MSDN remoting examples.

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