我在WCF的客户端返回一个已定义的类型。也就是说,通用T

时间:2017-09-27 02:02:14

标签: c# wcf generics service serviceknowntype

如何在WCF中返回客户端的已定义类型。也就是说,使用通用服务的通用T.。

我有这个错误:输入' System.Collections.Generic.List`1 [T]'无法导出为架构类型,因为它是一个开放的泛型类型。如果所有通用参数类型都是实际类型,则只能导出泛型类型。

接口:

[OperationContract]
List<T> getResultOperation<T>(bool tran = false);

我的服务:

public List<T> getResultOperation<T>(bool tran = false)
        {
            List<T> lista = new List<T>();

            return lista;
        }

我的客户:

ServiceReference instance = new Servicereference();
List<myClass> list = List<myClass>();
list = instance.getResultOperation<myClass>();

0 个答案:

没有答案