Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:37:07+00:00 2026-05-26T13:37:07+00:00

Ok, Im having major problems trying to expose this enumerated type over my webservice.

  • 0

Ok, Im having major problems trying to expose this enumerated type over my webservice. It does not function in the same way as my custom classes, in terms of exposing them.

ServerSide:

[DataContractAttribute]
public enum EventReportType {EventAutoContract, DailyAutoContract, EventFunctionSheet }

Clientside:

// For a custom class I would do:
ServerRef.MyClass maclass = new ServerRef.MyClass();
// but the following does not work.
ServerRef.EventReportType myenum = new ServerRef.EventReportType();
enum test = new ServerRef.EventReportType();

I dont think its even in the WSDL, so how do I get it to expose properly?
And how would I consume and use it?

Please look at my other question too for a bounty : REST with nullable types?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:37:08+00:00Added an answer on May 26, 2026 at 1:37 pm

    Because the type is an enum, you don’t create instances of it, you access static representations of values.

    For instance,

    var value = EventReportType.EventAutoContract;
    

    But in general, you won’t assign the value to a variable unless you need to, you would just use it explicitly; so, say calling a service method which accepts an enum value from this type:

    myServiceCall(EventReportType.EventAutoContract);
    

    Note that you don’t need to explicitly spell out the DataContractAttribute either, this can be shorthanded to DataContract, also, you probably require each enum member to be augmented with the EnumMember attribute, too. So…

    [DataContract]
    public enum EventReportType 
    {
        [EnumMember]
        EventAutoContract, 
        [EnumMember]
        DailyAutoContract, 
        [EnumMember]
        EventFunctionSheet 
    }
    

    You can find a reference for using enumeration types in data contracts here. Ultimately, if your enum is properly defined and used somewhere in the service which is exposed to the client side, then the enum will be generated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having major problems getting Django working with my Apache configuration. I did not
I'm having some major problems trying to get a ? inside of hrefs that
I'm having a major performance issue with LINQ2SQL and transactions. My code does the
I'm having major difficulties to start off with NHiberante. Main problems: Where my hbm.xml
I'm having some major headache trying to apply CSS3 transitions to a slideshow trough
I'm having a couple of problems with this site. Actually it's my lack of
i'm trying to build a Java applet and i'm having a major problem trying
I'm having a couple of major issues when trying to style the ChildWindow control
VC++ 2010, OpenGL, GLSL, SDL So I am having two major problems. I am
I'm having one hell of a headache trying to figure this out for myself,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.