.net远程处理-List< T>的问题 [英] .net remoting - Problems with List<T>

查看:104
本文介绍了.net远程处理-List< T>的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.Net Remoting开发客户端服务器应用程序。我想从我的服务器返回一个List来响应某个方法调用,但是我得到一个异常,说基本上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.

推荐答案

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

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.

如果必须使用泛型(我个人考虑将其升级到WCF),则有 MSDN远程处理示例中的一些示例,

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.

这篇关于.net远程处理-List< T>的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆