Returning ArrayList from WebServices

  • Thread starter Ashish Saxena via .NET 247
  • Start date
A

Ashish Saxena via .NET 247

Hi all

public System.Data.DataSet GetDataSetParam(string sProcName,ArrayList aParameterName, ArrayList aParameterValue)
{

when i m calling from my windows application then its givin me error that
collection.arraylist can not be converted to object..but i m writting same peice of code in my windows function its working fine.


please suggest me the way how to pass & return the arraylist ..

Thx & regards,


From: Ashish Saxena
 
B

Brock Allen

Return an array instead. ArrayList is a class in .NET that has no meaning
to your interop client (java, perl, C++, VB6).
 
K

Krishna

You could use CollectionBase for passing strongly typed
collections from web services. The proxy class then
converts this to an array.

public class Apples : System.Collections.CollectionBase
{
public void Add(Apple apple)
{
this.InnerList.Add(apple);
}

public Apple this[int index]
{
get { return (Apple ) this.InnerList
[index]; }
set { this.InnerList[index] = value; }
}
}

public class Apple
{
public string countryoforigin;
public string colour;
}
 

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,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top