Rebuild the application and update the web references.
![vb net array vs arraylist vb net array vs arraylist](https://i.ytimg.com/vi/EPSrMcQUB0g/maxresdefault.jpg)
The XmlInclude attribute tells the web service that the ArrayList will contain the elements of type Customer. You can however explicitly tell the web service to generate the classes by decorating the WebMethod with XmlInclude attribute. Since, ArrayList is not strongly typed the proxy generated has no idea what classes to create. Now, when you are instantiating the FooClient proxy you will realize that the Customer class is gone from the proxy implementation. Rebuild your application and update the web references. Our web service method will look like the following: Now, let's take a step back to the good old days of ArrayList. This is because you are returning List from the WebMethod and it gets serialized on the way. You will note that you will be able to access the Customer object which was created in the web service project.
![vb net array vs arraylist vb net array vs arraylist](https://www.jacksondunstan.com/wp-content/uploads/2015/05/ArrayListPerformance.png)
Now, on the client side you will access this web service using the following code:įooClient.FooService service = new () One interesting thing that you must note is that since you are returning a list of Customer objects the Customer object is serialized and placed in the WSDL file and also in the Reference.cs file in your client project. Then you will add the web reference to your client project and access this web method. List.Add(new Customer("Mohammad", "Azam")) The implementation of the WebMethod is shown below: NET 2.0 framework then you can simply return a generic list back to the client.
![vb net array vs arraylist vb net array vs arraylist](https://cdn.educba.com/academy/wp-content/uploads/2019/06/VBA-ArrayList-Example-2-4.png)
Vb net array vs arraylist how to#
In this article we will look at how to send a list back to the web service client using. NET 1.0/1.1 then you can send back an ArrayList object. NET framework 2.0 then you can simply return a strongly typed List. When working with web services sometimes we need to return a collection of objects.