Using ArrayList in Client side

J

James Q

Hello,

I have tried to define my Web Service's method so, that client could use
ArrayList insted of ordinary Arrays ( [ ] ). I haven't resolved how to do
it.
In serverside it's easy yo use ArrayList, but not in client side.
How should I define those XML tags into my classes
that code like below would work using ArrayList in Client side?
Environment is VS.NET 2003

C# Code

{
[XmlElement(ElementName="Elements", Type=typeof(Element))]
public ArrayList XElements
{
get
{
return Elements;
}
set
{
Elements = value;
}
}
}
/**
* Element information.
**/
public class Element
{
......

// XML

<Header>
...
</Header>
<Elements>
<Element>
<Field1> 1 </Field1>
<Field2> 2 </Field2>
<Field3> 3 </Field3>
<Field4> 4 </Field4>
</Element>
<Element>
<Field1> 1 </Field1>
<Field2> 2 </Field2>
<Field3> 3 </Field3>
<Field4> 4 </Field4>
</Element>
<Element>
<Field1> 1 </Field1>
<Field2> 2 </Field2>
<Field3> 3 </Field3>
<Field4> 4 </Field4>
</Element>
<Element>
<Field1> 1 </Field1>
<Field2> 2 </Field2>
<Field3> 3 </Field3>
<Field4> 4 </Field4>
</Element>
</Elements>
<Footer>
...
</Footer>


<Cheers/>
 
R

recoil

Hello James. I don't believe that ArrayLists are serialized across Web
Service method stubs. You will probably have better luck just returning
Type[] and then AddRange to an ArrayList on the other side. Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top