0

i have these code at my core application

[System.Serializable()]
public enum FieldOfDiscipline : int
{
None = 0,
ArchitecturalEngineeringFacilitiesManagement = 1,
ArtsLibraryScienceServices = 2,
AssetManagement = 3,
BusinessCorporatePlanning = 4,
DataStatistics = 5,
ExecutiveAssistance = 6,
FinancialServices = 7,
HealthServices = 8,
HumanResourceTrainingServices = 9,
InformationTechnologyServices = 10,
InternalAudit = 11,
InternationalOperations = 12,
LegalInvestigationServices = 13,
LoansCreditOperations = 14,         
ManagerialExecutive = 15,
PaymentsSettlements = 16,
ProcurementServices = 17,
PublicRelationsCommunications = 18,
ResearchDevelopment = 19,
Others = 255
}

im using it in my web service

now when i reference my web service and use the enum in my web application it is giving me a different integer value, so i investigated to go to the definition i was referenced to this

#region Assembly App_WebReferences.3joumvby.dll, v2.0.50727
// C:\Users\Carlo\AppData\Local\Temp\Temporary ASP.NET Files\bsper.website\6db12346\_shadow\6f228f03\286299993\30323649\App_WebReferences.3joumvby.dll
#endregion

using System;
using System.CodeDom.Compiler;
using System.Xml.Serialization;

namespace BSPeR.ApplicationServiceProvider
{
    [Serializable]
    [XmlType(Namespace = "http://tempuri.org/")]
    [GeneratedCode("System.Xml", "4.0.30319.2022")]
    public enum FieldOfDiscipline
    {
        None = 0,
        ArchitecturalEngineeringFacilitiesManagement = 1,
        ArtsLibraryScienceServices = 2,
        AssetManagement = 3,
        BusinessCorporatePlanning = 4,
        DataStatistics = 5,
        ExecutiveAssistance = 6,
        FinancialServices = 7,
        HealthServices = 8,
        HumanResourceTrainingServices = 9,
        InformationTechnologyServices = 10,
        InternalAudit = 11,
        InternationalOperations = 12,
        LegalInvestigationServices = 13,
        LoansCreditOperations = 14,
        ManagerialExecutive = 15,
        PaymentsSettlements = 16,
        ProcurementServices = 17,
        PublicRelationsCommunications = 18,
        ResearchDevelopment = 19,
        Others = 20,
    }
}

Noticed the integer value of Others? It was changed to 20 from 255.

for e.g when I use this code

(int) FieldOfDiscipline.Others it will return an integer value of 20 instead of 255

How can I get the original value or the value that I've assigned?

1
  • A web service it only interested in the textual name, not the integer value. Commented Sep 17, 2013 at 16:33

1 Answer 1

1

WSDL uses XML schema to describe datatypes. A .NET enum (int and label) has no directly equivalent XML schema datatype and so .NET represents an enum as a set of labels. Therefore, the int values do not appear in the service description (WSDL + XSD) of your web service. I can only assume that the client proxy generation process (svcutil I assume) has generated its own int values.

Also see this for a similar Java question: Enum Type in WSDL representation

Sign up to request clarification or add additional context in comments.

1 Comment

So I need to avoid using the enum's integer values for my codes but instead use the actual enum type to avoid errors...thanks for the input...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.