Solved

XML Enums

Posted on 2006-07-12
2
724 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
"Go Fund Me" type plugin 5 66
hbo knew my windows software 4 89
Un-Indent Setting Notepad++ 3 35
How do I buy BitCoin? 4 27
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

732 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