Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Visual Studio.NET 2003 generates type object[] for ArrayList method return

Reply
Thread Tools

Visual Studio.NET 2003 generates type object[] for ArrayList method return

 
 
JDeats
Guest
Posts: n/a
 
      10-27-2003
I've noticed what appears to be a bug in the Visual Studio.NET (1.0
and 2003 versions). If I declare a web method like so:

[WebMethod]
public ArrayList GetMyList()
{
ArrayList list = new ArrayList()
list.Add("one");
list.Add("two");
return list;
}


If I bind to the above from a client application like so:

ArrayList newlist = mywebservice.GetMyList();

The above fails (sometimes, sometimes it works), the compiler expects
a type of object[] (object array) and not ArrayList. Casting also
fails. I've even tried the following:


[WebMethod]
public object[] GetMyList()
{
ArrayList list = new ArrayList()
list.Add("one");
list.Add("two");
return list.ToArray();
}

Sometimes it works, sometimes it doesn't work. The later example never
works. Can anyone explain this? Is it a IDE generated code bug?
 
Reply With Quote
 
 
 
 
Dino Chiesa [Microsoft]
Guest
Posts: n/a
 
      10-31-2003
have a look at this
http://www.fawcette.com/vsm/2001_12/...efault_pf.aspx

It explains the situation you are confronting.

-Dino


"JDeats" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> I've noticed what appears to be a bug in the Visual Studio.NET (1.0
> and 2003 versions). If I declare a web method like so:
>
> [WebMethod]
> public ArrayList GetMyList()
> {
> ArrayList list = new ArrayList()
> list.Add("one");
> list.Add("two");
> return list;
> }
>
>
> If I bind to the above from a client application like so:
>
> ArrayList newlist = mywebservice.GetMyList();
>
> The above fails (sometimes, sometimes it works), the compiler expects
> a type of object[] (object array) and not ArrayList. Casting also
> fails. I've even tried the following:
>
>
> [WebMethod]
> public object[] GetMyList()
> {
> ArrayList list = new ArrayList()
> list.Add("one");
> list.Add("two");
> return list.ToArray();
> }
>
> Sometimes it works, sometimes it doesn't work. The later example never
> works. Can anyone explain this? Is it a IDE generated code bug?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does the clone() method of ArrayList<> make a copy of the objects in the ArrayList? xz Java 16 08-04-2007 10:33 PM
Visual Basic .NET 2003 vs. Visual Studio .NET 2003 TJ MCAD 1 09-23-2005 07:13 PM
a class inherited from ArrayList, is saved to ViewState, why the type of the object read from ViewSate is not the class, but the parent, ArrayList leal ting ASP .Net 1 02-10-2004 07:45 PM
writeObject with ArrayList of ArrayList? Kaidi Java 4 01-03-2004 08:16 PM
Iterate through ArrayList using an another ArrayList Saravanan Rathinavelu ASP .Net 3 08-19-2003 07:03 AM



Advertisments