I return a defined type on the client side in WCF. that is, a generic T

161 Views Asked by At

how can I return a defined type on the client side in WCF. that is, a generic T. to use a generic service.

I have this error: Type 'System.Collections.Generic.List`1[T]' cannot be exported as a schema type because it is an open generic type. You can only export a generic type if all its generic parameter types are actual types.

Interface:

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

my service:

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

            return lista;
        }

my client:

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

There are 0 best solutions below