Returning Arrays of Simple Types
ASP.NET treats arrays of simple types as a list of items. Like everything we have seen so far, developers have little to think about other than stating that an array is being passed in or returned. To demonstrate the power here, we will write a Web Method in Listing 1.3 that returns an array of random numbers. As arguments, it will take the number of items to be returned as well as the smallest and largest permissible values to be returned.
Listing 1.3. Source for the FirstService.GetRandomNumbers Function
<WebMethod()> Public Function GetRandomNumbers( _ ByVal arraySize As Long, ByVal min As Long, _ ByVal max As Long) As Long() Dim retval(arraySize - 1) As Long Dim rnd As New System.Random() Dim index As Long ... |
Get Creating and Consuming Web Services in Visual Basic® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.