Enum Problem with asp.net webservice

  • Thread starter Michael Tholkes
  • Start date
M

Michael Tholkes

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
 
M

Martin Kulov

Hello Michael,

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

Martin Kulov
 
M

Michael Tholkes

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
 
D

Dan Rogers

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
--------------------
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top