Solved

XML Enums

Posted on 2006-07-12
2
725 Views
Last Modified: 2008-01-09
i have a class which contains xml enums, I am not able to use integers or any special characters

Example :
I cannot use like <XmlEnum(Name:="CHG")> 1 ...i will get a error.... as end of enum expected ....I have to use ( _ ) Underscore infront of 1 inorder to use 1 but when i bind it to a dropdownlist the display text will be _1. How to avoid the _1 inside dropdownlist. I have avoided through the code but how to achieve this using only XMLEnum.

This class was created  using a xmlschema from xsdobjectgen.exe .

I have to use like the below code i have written  


Namespace Test.Web.Enums

    Public Module Declarations
        Public Const SchemaVersion As String = ""
    End Module
<Serializable()> _
    Public Enum PaymentType
        <XmlEnum(Name:="CHG")> _1  ---------------> (I want to avoid _1)
        <XmlEnum(Name:="COD")> COD
        <XmlEnum(Name:="PPD")> PPD
    End Enum
0
Comment
Question by:Chandan_Gowda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
jkievlan earned 50 total points
ID: 17111047
Like this:

<Serializable()> _
Public Enum PaymentType
  <XmlEnum(Name:="CHG")> CHG = 1
  <XmlEnum(Name:="COD")> COD
  <XmlEnum(Name:="PPD")> PPD
End Enum

The expression you enter after <XmlEnum()> is the name of the enumeration member, so of course you can't use 1 as that's an illegal variable name.  _1 will work but that's not what you want.  So the solution, I would think, is to use the name of the XmlEnum as the member name, and set its value to 1.  Is there any reason this wouldn't work for you?
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question