Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2003

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JDeats - 27 Oct 2003 23:18 GMT
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?
Dino Chiesa [Microsoft] - 31 Oct 2003 21:07 GMT
have a look at this
http://www.fawcette.com/vsm/2001_12/online/online_eprods/webservices_yshohoud12_
12/default_pf.aspx


It explains the situation you are confronting.

-Dino

> 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:
[quoted text clipped - 27 lines]
> Sometimes it works, sometimes it doesn't work. The later example never
> works. Can anyone explain this? Is it a IDE generated code bug?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.