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 / November 2004

Tip: Looking for answers? Try searching our database.

Enum Problem with asp.net webservice

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Tholkes - 04 Nov 2004 21:22 GMT
Hello,

I have a web service project with an enum like this:
   public enum EventType{ AppStart=1, AppEnd=2}

In a console app, I cast EventType.AppStart as an int and the value is zero
and not one!!!

Is there anything I can do to get it to work correctly on the client?  The
same enum works fine in the a class that uses it in the same web service
project.

Thanks in advance,
Mike
Martin Kulov - 04 Nov 2004 22:56 GMT
Hello Michael,

Do you have the same definition for public enum EventType on the client side also?

Martin Kulov
Michael Tholkes - 04 Nov 2004 23:22 GMT
No I do not...  I was hoping to keep it on my central web service and not
have to copy the enum to all of the clients...

Mike

> Hello Michael,
>
> Do you have the same definition for public enum EventType on the client side also?
>
> Martin Kulov
Dan Rogers - 11 Nov 2004 23:41 GMT
Hi Mike,

You didn't specify how your console app was deterimining the enum item's
value.  If you were accessing via a proxy, and the enum type was one of the
parameter types on your web method, the enum should have been copied over
to the namespace for your proxy class, and it's value preserved.  If you
are just formatting XML, there is no shared infomation, and the console app
won't have a way to resolve to the same enum definition (where DID it get
the enum from?)

Hope this helps,

Dan Rogers
Microsoft Corporation
--------------------
>From: "Michael Tholkes" <michaeltholkes@clearchannel.com>
>Subject: Enum Problem with asp.net webservice
[quoted text clipped - 8 lines]
>NNTP-Posting-Host: 207.230.144.240
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26381
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 12 lines]
>Thanks in advance,
>Mike

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.