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

  • SEARCH
  • Home
  • 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 9258999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:32:58+00:00 2026-06-18T12:32:58+00:00

I have defined the following enum on the WCF server side: [DataContract] public enum

  • 0

I have defined the following enum on the WCF server side:

[DataContract]
public enum CarConditionEnum {
    [EnumMember]
    New,
    [EnumMember]
    Used,
    [EnumMember]
    Rental,
    [EnumMember]
    Broken,
    [EnumMember]
    Stolen
}

The operation contract method interface method I will use, also server-side:

[OperationContract]
string WhatEnumDidIUse(CarConditionEnum carCondition);

The method implementation for this interface (server-side):

public string WhatEnumDidIUse(CarConditionEnum carCondition) {
    return carCondition.ToString();
}

When I generate a proxy to this service dynamically, the method it generates looks like this (and I’m pretty sure it’ll look the same if I generate it using a web reference):

/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/IService1/WhatEnumDidIUse", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string WhatEnumDidIUse(CarConditionEnum carCondition, [System.Xml.Serialization.XmlIgnoreAttribute()] bool carConditionSpecified) {
    object[] results = this.Invoke("WhatEnumDidIUse", new object[] {carCondition, carConditionSpecified});
    return ((string)(results[0]));
}

Why is there now this boolean to specify that the enumerable has been specified?

Also, why does this boolean behave strangely? For example, if I set the boolean argument to false, my method will always return the first enumerable, New. If I set the boolean argument to true, it will return whatever enumerable I actually specified.

  • 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-06-18T12:33:00+00:00Added an answer on June 18, 2026 at 12:33 pm

    This is because the boolean indicates whether or not the enum parameter has been supplied. If not, then it will behave as though you had supplied the enum with integer value zero.

    Having said that, I don’t understand why the “*specified” is there. The enum must always be present, based on your code. If you had specified CarConditionEnum?, then I would understand it.

    Are you sure this is a WCF service? That looks like an ASMX prologue.

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

Sidebar

Related Questions

I have the following enum defined. I have used underscores as this enum is
I have the following property defined. MyLibrary.PumpSignal is an enum as follows: Public Enum
I have the following enums defined in my code: [Flags] public enum Symbol {
Imagine I have defined the following Enum: public enum Status : byte { Inactive
I have defined the following Interface [ServiceContract] public interface IHealthProducts { [OperationContract()] ResponseClass OrderSelfSignedHealthCertificate();
Let's say I have defined the following class: public abstract class Event { public
I have an enum defined as follows: public enum CrystalTypeEnum { Red, White, Blue,
I have defined an EnumRule like following in my Xtext grammar file: enum MySpec_directionEnum:
I have a question about enum C. I defined an enum in the following
I have the following code: public IFoo getFoo(Type type) // Type is an enum

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.