I am developing a web application using MVC 3 and ASMX Web Services.
I am trying to send a List< object > to a Web Method, but I get the following error:
" cannot convert from 'System.Collections.Generic.List' to 'WebServiceClass.ArrayOfAnyType' "
This is my Web Service definition:
public class WebServiceClass : System.Web.Services.WebService
{
[WebMethod]
public bool MyWebMethod(List<object> ParameterValues)
{
//do stuff..
}
}
And this is the block of code where I call the Web Method:
List<object> ParameterValues = new List<object>();
WebServiceClass.WebServiceClassSoapClient MyWebService = new WebServiceClass.WebServiceClassSoapClient();
//I use actual objects here, this is just for an example
ParameterValues.Add(new DateTime(2012,5,2));
ParameterValues.Add(23);
ParameterValues.Add("some string");
MyWebService.MyWebMethod(ParameterValues);
My idea was to save time and pass Lists of objects to all Web Methods instead of defining WebMethod(DateTime date, int someint, string somestring).
Is there a solution for this?
Best regards.