Reputation: 355
I have this code:
List<string> emailsToFollow = new List<string>();
ASMXWebServiceReference.WebServiceSoapClient MyASMXWebServiceClient = new ASMXWebServiceReference.WebServiceSoapClient();
//Add values to List here
//Call the webservice
ASMXWebServiceReference.SendResponse mySendResponse = await MyASMXWebServiceClient.SendAsync("[email protected]", emailsToFollow);
And in the webservice this is the title of my function:
public bool Send(string myEmail, string[] emaislToFollow)
The problem is that I got this error:
Error Argument 2: cannot convert from 'System.Collections.Generic.List' to 'App9.ASMXWebServiceReference.ArrayOfString'
Why?
Upvotes: 1
Views: 3146
Reputation: 2924
I finally got the answer and updating my post. Well, it seems that you have to make a bit of conversion here
ASMXWebServiceReference.ArrayOfString myArray = new ASMXWebServiceReference.ArrayOfString();
myArray.AddRange(emailsToFollow);
It seems that out of th service you have to use ArrayOfString class and convert your collection to this very spesific type.
Hope this helps.
Upvotes: 1
Reputation: 14389
change the signature of Send:
public bool Send(string myEmail, List<string> emaislToFollow)
Upvotes: 1