Can we send a Generic List ( List) as a parameter to a WCF OperationContract?
Seems like the only way to do it is to encapsulate the List as a DataMember inside another Class and specify the class as a DataContract:
But that doesn't look right to me. Is there any other way?
EDIT1:
intended Signature:
[OperationContract]
List<int> OperationName(List<CustomObject> objects);
This translates to CustomObject[] at the client. I am currently passing CustomObject[] from my client and it works fine, but I want to know why I can not pass
List <CustomObject>
which gives me a compile error saying there is no overloaded version of the function which takes the specified parameters (type mismatch error)
EDIT 2:
Related Questions:
1) I should be able to control this from the service itself. What if I am exposing my service to the entire world and the wsdl/Proxy is the only way they would know of the signature of my OperationContract?
2) What if I want to use both System.Array and System.Generic.List in different Operation Contracts in the same Service Contract?