Hi

I am trying to use web services for the first time.

I am using .net 2.0.

I am tring to get what is essentially an array of data. This approach would work.

Dim test As New ArrayList
test.Add("one")
test.Add("two")
test.Add("three")
Return test

The only problem here is that I need pairs of related info to be returned. Like this

Dim test As New Hashtable
test.Add("first", "one")
test.Add("second", "two")
test.Add("third", "three")
Return test

But it appears I cannot do this. Do you know of a way I could bring back the data in related pairs.

Essentially the first value is the folder name(first, second, third) and the second value(one, two, three) is the file name within that folder.

Web-Methods can return any serializable data type.

Check the following link which tells you about data types supported by web service.

Data Types Supported by XML Web Services Created Using ASP.NET

You can the following ways,

1. Store the pairs in a DataSet and return it from your web method.
2. The above link says that arrays of classes is supported by web method. So create a class having two properties to store name, value pair and create an array of objects for that class and return it from web method.

Or check the following article.

Hashtable becomes serialized

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.