I would like to retrieve a list of objects from my web service ,but I am struggling with Object Types.
I have this code :
[WebMethod]
public Car[] GetAllCars()
{
List<Car> cars = new List<Car>();
cars.Add(new Car ("fiat", 1999);
cars.Add("opel" ,2007);
cars.Add("chevrolet",2007);
return cars.ToArray(); //
}
When I test the web service from my browser ,everything's fine . it displays me what is should.
But in the client side when I try to do
MyWebService.WebService1SoapClient cars = new MyWebService.WebService1SoapClient();
Car[] l = (Car[]) cars.GetAllCars();
it says cannot convert ClientApp.MyWebService.Car[] into ClientApp.model.Car[]
the Car class is the same for the both sides ( client and web service).
What should I do to tackle this problem ?
thank you advance .