I have a web services and a web aplication.
The web service has the following code:
List<string> listCen =new List<string>();
serviciowebclienteKmeans.ServicioWebKmeans serv = new serviciowebclienteKmeans.ServicioWebKmeans();
serv.Parameters(element, number, out listCen);
I don’t enter more detail that is not necesary, in my web application I have the following code
public double[][] Parameters(int N_element, int N_number, out List<string> list2)
{
}
but I receive the error that “cannot convert System.Collections.Generic.List to string[]”
Could someone explain the reason for this, by the way I am using Visual Studio 2010 Ultimate
and C#, i forgot to mention that one of the expectect result from de web services in the OUT statement is a list of string that may have 3 to 20 so what i really need is the list of string
So if I understand correctly, the first code snippet is accessing the web application via an auto-generated web reference class. Is that correct?
Even though your method uses a
List<string>in its definition, this is indistinguishable from an array in terms of the way the data is transmitted between the web application and the calling code. Visual Studio interprets the web application’s definition in such a way thatList<>s are treated as arrays in the reference class. The solution is simple – just pass it an array: